Hi folks,
I've looked through the forum and can't find an answer to this one.
I have a ManyToMany self relationship with a custom join table (I
don't think the self-reference is important to the problem, but it
might be, so I'm mentioning it):
class Documents
related_docs = models.ManyToManyField("self",
through='DocumentRels')
DocumentRels is a table that maps one document to another, with a
relationship type.
If I want all documents related to doc_0, I can just do:
doc_0.related_docs
But what if I want all documents related to doc_0 where I specify an
extra constraint on the join table, e.g. a value for
DocumentRels.relationship? Is there a way to do that without custom
SQL?
Thanks!
-Ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---