Re: key error in templates
On Thursday 17 June 2010 06:46:21 Kenneth Gonsalves wrote:
> in many models with an imagefield called photo, I have this code in the
> template:
>
> {% if p.photo %}
> <img src="{% thumbnail p.photo 400x400 %}" />
>
> {% endif %}
>
> this has been working across many sites for years - and is working on a
> particular site running Revision: 12453.
>
> In my current project I am getting keyerror: photo where the photo does
> not exist. This is running on latest trunk. The only difference between
> the two sites is that in site where it is working, 'p' is a query set
> passed from the view, whereas in the site where it is not working, the
> values are got from a pickled file, so the code is like this:
>
> {% if hand.0.player.photo %}hi{% endif %}
>
I have now confirmed that this KeyError also comes in revision 12453 - so it is
a problem with my code
--
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC
--
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