Hi Ian

On Sat, 29 Jul 2006 11:36:17 +1000, Ian Holsman wrote:

> but personally I just use foreign keys on the middle table, as I  
> think it makes the code more readable, and allows you to be more
> flexible with it. (for example a M2M with a generic flavor)

Like the intermediary model described here: 
http://www.djangoproject.com/documentation/models/m2m_intermediary/
?

Actually I kinda like the idea of having an explicit definition of the m2m
link table, but what I also want is the ability to use the standard m2m
manager on instances of the related objects.  I.e. image.tags.all() gives
me all the tags related to this image in a query set, rather than having
to go [i.tag for i in image.intermediary_set.all()] or similar.

> What I would like to see (and might already be there.. I haven't  
> looked to closely lately) is a common naming standard for the  
> relationships
> (foreign, one-to-one,  or many) so that I can just switch a M2M to a  
> Foreign key in the model with no effect on the code which uses it.
> 
> (django might do this.. it's been a while since I used M2M)

I think it already does this for the reverse m2m relation (I think), e.g.
using the models I defined before Tag objects have an 'image_set' manager.
I'm not quite sure this is what you're talking about though.

> regards
> Ian

Cheers
Neilen

-- 
you know its kind of tragic 
we live in the new world
but we've lost the magic
-- Battery 9 (www.battery9.co.za)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to