Sunday, August 30, 2015

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

Ok, thanks. It seems like such a common use case that I wanted to be sure there was not an existing template tag for it.


On Sunday, 30 August 2015 14:48:47 UTC-7, Christophe Pettus wrote:

On Aug 30, 2015, at 2:37 PM, Christophe Pettus <x...@thebuild.com> wrote:

> On Aug 30, 2015, at 12:43 PM, Dennis Marwood <dennis...@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.

As a note, this is a feature, not a bug: If template expansion iterated like that, it would be a serious security hole, since someone could drop template items ( {{ entry.delete }}, anyone?) into user-edited content.

--
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/bad2c6f3-cdf4-447d-87e1-9a50f439efd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment