Friday, May 20, 2011

failing to pass model objects to template for some reason....

I have a model class called Message with an attribute called text.

** When I pass a list of these objects called messages to my template,
it doesn't show up.

** When I instead create this derivative called fred, that *does*
work...
fred = [e.text for e in messages]

Why would fred work fine in template but not messages?


Here is my template code for messages that doesn't show anything on
page..

{% for e in messages %}
<p class = "message">{{e.date}}: {{e.text}}</p>
{% endfor %}


Here is the fred code that does work..
{% for e in fred %}
<p class = "message">{{e}}</p>
{% endfor %}

cs

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate