Michel Thadeu Sabchuk wrote: > 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".
In your tag you can catch the exception template.VariableDoesNotExist that is raised by the template.resolve_variable() function. Something like this: try: city = template.resolve_variable(variable_name, context) except template.VariableDoesNotExist: city = 'London' -- Jon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---