Correction for Django’s ifchanged patch article

My article Django’s template syntax, enhanced ifchanged contained a couple of errors in my thinking.

For one the code I had shown


{% for country in countries %}
    {% for city in country.cities %}
{{ city.name }}
{% endfor %} {% endfor %}

would never produce the expected output


Berlin
Munich
Hamburg
Barcelona
Valencia
Madrid
Moscow
Kiev
St. Petersburg

What it outputs instead is the following:


Berlin
Munich
Hamburg
Barcelona
Valencia
Madrid
Moscow
Kiev
St. Petersburg

And that is simply because I had a logical error while writing the article. I was so excited about having a useful patch for Django and I also saw it soooo reasonable to have this change (which I still do) that I was blind and didn’t really test the patch.

But now
I have written the tests and added them to the ticket. And I still see the patch as something useful. And another patch for Django’s template system is under way … I feel like I either don’t really understand how to use the Django’s template system or it really lacks the basic functionality that I am trying to provide by the patches. We will, see let me get deeper into it and I will be enlightened I hope :-)

Sorry for the confusion …

RSS feed for comments on this post · TrackBack URL

Leave a Comment