In the API documentation it says:
Many-to-many relationships

"Both ends of a many-to-many relationship get automatic API access to
the other end. The API works just as a "backward" one-to-many
relationship.
The only difference is in the attribute naming: The model that defines
the ManyToManyField uses the attribute name of that field itself,
whereas the "reverse" model uses the lowercased model name of the
original model, plus '_set' (just like reverse one-to-many
relationships)."

Problem is, the examples it goes on to give of all the things that you
can do with a M2M model need more knowledge of Python than I have. So
can somebody point me in the right direction?

Here are my models(abbreviated):


class Category (models.Model):

    category = models.CharField (maxlength = 100)
    slug = models.CharField(maxlength=50, unique=True,
prepopulate_from=('category',))
    class Meta:
        verbose_name_plural = "categories"


    def __str__(self):
        return self.category

    def get_absolute_url(self):
        return self.slug


class Organisation (models.Model):

    org_name = models.CharField ('Organisation', maxlength = 200)
    categories = models.ManyToManyField (Category, filter_interface
=models.HORIZONTAL)

    def __str__(self):
        return self.org_name

    def get_absolute_url(self):
            return self.slug




Now, using the category_list and/or category_detail GENERIC templates,
what on earth do I put in to return a list of Organisations by
Category?

The site's (half)-live here:
http://www.ketteringcommunity.com/directory

(Just so that all the kind folks who have helped me so far on this list
can see I'm getting somewhere...)


--~--~---------~--~----~------------~-------~--~----~
 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