#10975: Accessing derived block doesn't work within ifequal tag
-------------------------------------------+--------------------------------
          Reporter:  [email protected]  |         Owner:  nobody
            Status:  reopened              |     Milestone:        
         Component:  Uncategorized         |       Version:  SVN   
        Resolution:                        |      Keywords:        
             Stage:  Unreviewed            |     Has_patch:  0     
        Needs_docs:  0                     |   Needs_tests:  0     
Needs_better_patch:  0                     |  
-------------------------------------------+--------------------------------
Changes (by dnozay):

  * status:  closed => reopened
  * resolution:  invalid =>

Comment:

 you can paste this at the end of your settings.py

 {{{
 #!python

 from django.template.defaulttags import IfEqualNode

 def get_nodes_by_type(self, nodetype):
    nodes = []
    if isinstance(self, nodetype):
       nodes.append(self)
    nodes.extend(self.nodelist_true.get_nodes_by_type(nodetype))
    nodes.extend(self.nodelist_false.get_nodes_by_type(nodetype))
    return nodes

 IfEqualNode.get_nodes_by_type = get_nodes_by_type
 }}}

 IMHO, this should be reopened and fixed.
 Users may want to display things differently according to a condition,
 e.g. I would want to have that in a base template:

 {{{
 {% ifnotequal setting u'inverted'%}
    {% block a %}{% endblock %}
    {% block b %}{% endblock %}
 {% else %}
    {% block b %}{% endblock %}
    {% block a %}{% endblock %}
 {% endifnotequal %}
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10975#comment:4>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to