Hi guys!

I've done a custom tag to use on my templates and I ned to pass a
variable to it, but this variable can or cannot exists. If the
variable doesn't exists, I get an error telling that form.data doesn't
have the key "city".

To avoid this error I've done:

{% block body_onload %}
    {% if form.data.city %}
        {% cidades_bodyonload form.data.city %}
    {% else %}
        {% cidades_bodyonload %}
    {% endif %}
{% endblock %}

I looking for a way to contract this, I try:

{% block body_onload %}{% cidades_bodyonload form.data.city|default:''
%}{% endblock %}

But I couldn't use filters here.
Do you have any suggestion?

Thanks in advance!


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to