On Fri, Feb 4, 2011 at 11:07 AM, Tom Evans <tevans...@googlemail.com> wrote:
> On Fri, Feb 4, 2011 at 9:53 AM, Andres Lucena <andresluc...@gmail.com> wrote:
>> Hi,
>>
>> In my base.html I'm trying to do this:
>>
>>        <title>{% block title %}{{title|default:"{{SITE_NAME}}"}}{%
>> endblock %}</title>
>>
>> But I'm getting this:
>>
>> TemplateSyntaxError at /
>> default requires 1 arguments, 0 provided
>>
>> So, SITE_NAME is not passed to the filter.
>>
>> As a workaround I did this:
>>
>>        <title>{% block title %}{% if not title %}{{SITE_NAME}}{% else
>> %}{{title}}{% endif %}{% endblock %}</title>
>>
>> But it's pretty ugly... Is there anyway to passing a variable to a
>> template filter??
>>
>> Thanks,
>> Andres
>>
>
> Yes, and you will kick yourself:
>
> {{ title|default:SITE_NAME }}
>

Yes, you're right, I'm kicking myself xD

> It is a template variable. Inside tags, template variables are
> unquoted and "values are quoted".
>

Oh. Didn't know that. Thank you!!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to