Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#13276 closed (duplicate)

load and include evaluated before if

Reported by: onelson Owned by: nobody
Component: Template system Version: 1.2-beta
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I stumbled into this, have a work-around for my specific case, but am wondering if this is expected behavior or not.

{% if someapp %} <!-- False if someapp is not in INSTALLED_APPS, else True -->
  {% load template_tags_from_someapp %} <!-- throws uncaught exception if "someapp" is False -->
  {% someapp_tag_foo %}
{% endif %}

Likewise, if I separate my app specific code into yet another template:

<!-- in my view's main template -->
{% if someapp %} <!-- False if someapp is not in INSTALLED_APPS, else True -->
  {% include 'someapp_sepecific/extras.html' %}
{% endif %}
<!-- in someapp_specific/extras.html -->
{% load template_tags_from_someapp %} <!-- throws uncaught exception if "someapp" is False -->
{% someapp_tag_foo %}

Obviously there are many ways to skin a cat, but I'm actually hoping this is "fixed" at some point as it will reduce the number of views I'd have to write greatly (allowing me to lean more heavily on the generic views system).

Change History (2)

comment:1 by Russell Keith-Magee, 15 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #12064.

comment:2 by onelson, 15 years ago

Ahh, great. I don't know how many ways I google'd for this - don't think I would have been able to find #12064 on my own. Thanks!

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