List Info

Thread: How many times my method returning dict is called in template?




How many times my method returning dict is called in template?
user name
2006-07-28 15:47:02
I have just thought of a simple - still ugly - fix to my
problem (remember, a method that return a dict, and my
template rerunning the method for each key of the
dictionary).

Previously I had something like:
-------------------------------------
{% for slave in master.get_slaves %}
    {{ slave.dict_keyA }}
    {{ slave.dict_keyB }}
    {{ slave.dict_keyC }}
{% endfor %}
-------------------------------------

Even if the method will always return one and only one dict
of
statistics, I could write it like:
-------------------------------------
{% for slave in master.get_slaves %}
    {% for my_dict in slave.get_statistics %}
        {{ my_dict.keyA }}
        {{ my_dict.keyB }}
        {{ my_dict.keyC }}
    {% endfor %}
{% endfor %}
-------------------------------------

Not very logic to me, but it works.

Meanwhile, I had a closer look at template tags. This part
could have been more documented, but James Bennett's
tutorials
came to rescue, and I think this feature of Django templates
could benefit better advertising.

Cet été, pensez aux cartes postales de laposte.net !



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )