Generic M2M

118 views
Skip to first unread message

James Pic

unread,
Jan 10, 2016, 8:41:46 AM1/10/16
to django-d...@googlegroups.com
Hi all,

Generic Foreign Keys is pretty useful, do you think Django could provide a model with 2 GFKs and Generic Many-to-Many fields ?

There is a little old implementation in an app that has been out there for a while so it's pretty old: https://github.com/coleifer/django-generic-m2m/

We could perhaps have multiple value support for raw_id_fields in the admin to support it.

Would it be worth working on a DEP for this ?

Götz Bürkle

unread,
Jan 10, 2016, 9:17:04 AM1/10/16
to django-d...@googlegroups.com
Hi James,

> Generic Foreign Keys is pretty useful, do you think Django could provide a model with 2 GFKs and Generic Many-to-Many fields ?
>
> There is a little old implementation in an app that has been out there for a while so it's pretty old: https://github.com/coleifer/django-generic-m2m/

I just looked into this a few days ago for an application I am
currently working on. Via
http://stackoverflow.com/questions/19772800/django-many-to-many-generic-relationship
I came across the project you mentioned and also another third-party
application that seems to achieve something similar with a slightly
different approach when it comes to table management:
https://bitbucket.org/tkhyn/django-gm2m
(https://pypi.python.org/pypi/django-gm2m)

The Stackoverflow thread references
http://python.6.x6.nabble.com/Generic-ManyToMany-Functionality-td476651.html
- so in 2007, there was support for this kind of feature, just not the
time to implement it.

I also think it would be useful to have it in Django. However, as
there are two third-party applications available that cover this
requirement, I am not sure if it really needs to be integrated into
Django. Maybe other people on the mailing list have a better overview
about how relevant such a feature is.

Kind regards,
Goetz
Reply all
Reply to author
Forward
0 new messages