On 5/27/06, chrisk <[EMAIL PROTECTED]> wrote: > > Hi * > > I'm on trunk and using 'CookBookCategoryDataModelPostMagic'. > > In my models file i have this: > > class Post(models.Model): > ... > assoc_cats = models.ManyToManyField(Category) > ... > > In my template {% for post in latest %}... works fine, but if i try to > use the Many-to-many related lookup {{ post.assoc_cats.all }} i get an > empty list. > > If i import my models in the shell post.assoc_cats.all() shows the > right things. > > I have no idea what i can do now. I would be grateful for each > assistance. > >
I don't think that {{post.assoc_cats.all}} is what you *really* want to do. More likely, you'd want something like: {% for post in latest %} {% for cat in post.assoc_cats.all %} {{ cat.name }} {% endfor %} {% endfor %} I don't think that QuerySets (which are what are returned by post.assoc_cats.all) can be represented directly in a template. Jay P. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---