Opened 8 years ago

Closed 7 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: UI/UX:

Description

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

{% if object.url %}
...my 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 8 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

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

comment:2 Changed 7 years ago by jacob

  • Resolution set to worksforme
  • Status changed from new to closed

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