Opened 11 years ago

Closed 11 years ago

#5689 closed (worksforme)

Empty/blank URLField evaluates true for template {% if %} tag

Reported by: Simon Litchfield <simon@…> Owned by: nobody
Component: Template system Version: master
Severity: Keywords: urlfield blank empty if template tag
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


As described in summary (rev 6453). Example --

{% if object.url %} html...
{% endif %}

Even where object.url is blank, my html is included. This behaviour is inconsistent with other fields.

I'll supply a patch if anyone is interested.

Change History (2)

comment:1 Changed 11 years ago by Chris Beaven

Why ask to supply the patch? Just add it! ;)

It sounds like a real bug, anyone care to confirm it?

comment:2 Changed 11 years ago by Jacob

Resolution: worksforme
Status: newclosed

Without seeing your model, I can't tell if this is a bug in Django or one in your code. I've never seen the {% if %} tag fail in this manner, so I'm marking worksforme.

Note: See TracTickets for help on using tickets.
Back to Top