Sunday, August 30, 2015

Re: Is there a way to make the template process {{ MEDIA_URL }} if it is stored in a model field.

On Aug 30, 2015, at 12:43 PM, Dennis Marwood <dennismarwood@gmail.com> wrote:

> How do I get the template to treat {{ }} in my entry as a variable?

The Django template language doesn't iterate over the results of expansion; once a substitution is done, it moves on. So, template language constructs that "appear" in the result due to variable expansion

You could do this by building the template up programmatically, and then passing the output of that process to the appropriate render method. You could also (probably better) write a custom template tag that does the right thing.

--
-- Christophe Pettus
xof@thebuild.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/524E4D09-5384-41BF-A43D-4C650944C53F%40thebuild.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment