> {% for machine in web %}
> {% for status_message in status.machine %}
> ...
> So, i want to be able to do something like status.machine..
If there's a BETTER way, I'd love to hear it too, but this is usually
accomplished with a custom filter.
It's commonly named "getattr", and your template would change like so:
{% load myfilters %}
{% for machine in web %}
{% for status_message in status|getattr:machine %}
...
You don't need to name it "myfilters.py", but the custom "getattr"
filter code MUST be in a directory named "templatetags/". Mine is a
little different (I didn't bother with the "default value"
capability), but I used the same basic concepts as:
http://www.djangosnippets.org/snippets/38/ (Read RichardBronosky's
comment too!)
http://www.djangosnippets.org/snippets/411/ (if you want to get a
little fancier)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---