On 6/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> That's what I thought, too, but I can't seem to access it. Maybe I
> need to just write a custom view for this page.

Based on what you've said so far, you shouldn't need to write a new
view. You just need to reference the m2m data correctly. Assuming you
have the models:

class Foo(models.Model):
    name = models.CharField()

class Bar(models.Model):
    name = models.CharField()
    foos =  models.ManyToManyField(Foo)

Then you can, in view code, ask for:
>>> Foo.objects.all()
>>> Bar.objects.all()
>>> mybar.foos.all()
>>> myfoo.bar_set.all()

And in template, if you have mybar and myfoo into the context, you can write:
{{ mybar }}
{{ myfoo }}
{% for foo in mybar.foos.all %}
    {{ foo.name }}
{% endfor %}
{% for bar in myfoo.bar_set.all }
    {{ bar.name }}
{% endfor %}

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to