Re: Template: nested for and ManyToMany field problem - MySQL

2006-06-19 Thread Adam Hoscilo

> Then you want entry.categories.all in your template.

That was the problem. Thanks.
--
Adam Hoscilo


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Template: nested for and ManyToMany field problem - MySQL

2006-06-18 Thread Max Battcher

Adam Hoscilo wrote:
> I get this error: len() of unsized object
> while doing nested for loops in the template:
> {% for entry in object_list %}
> {% for category in entry.categories %}
> {{ category.name }}
> {% endfor %}
> {{ entry.get_absolute_url }}
> {% endfor %}
> 
> entry.categries is ManyToManyField

Then you want entry.categories.all in your template.

-- 
--Max Battcher--
http://www.worldmaker.net/
"I'm gonna win, trust in me / I have come to save this world / and in 
the end I'll get the grrrl!" --Machinae Supremacy, Hero (Promo Track)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Template: nested for and ManyToMany field problem - MySQL

2006-06-18 Thread Adam Hoscilo

I get this error: len() of unsized object
while doing nested for loops in the template:
{% for entry in object_list %}
{% for category in entry.categories %}
{{ category.name }}
{% endfor %}
{{ entry.get_absolute_url }}
{% endfor %}

entry.categries is ManyToManyField
If i remove the nested for everything works fine.
I tried to fetch entries with .select_related() and without - no
difference.
Database backend is MySQL 5
Anyone had a problem like this one?
--
Adam Hoscilo


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---