Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Multiple ManyToManyFields to the same Model loses getters [RSS Feed]

#1 Nov. 28, 2005 13:57:10

p.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Multiple ManyToManyFields to the same Model loses getters


I've run into a problem with mutliple ManyToMany fields with the same
model. Only one set of the get_*_list() methods show up pointing
backwards:

class Group(meta.Model):
owners = meta.ManyToManyField( User, singular='owner',
related_name='ownerof')
members = meta.ManyToManyField(User, singular='member',
related_name='memberof')

With this model, I get a User.get_ownerof_list() method but not a
User.get_memberof_list()

However, if I flip the ordering:

class Group(meta.Model):
members = meta.ManyToManyField(User, singular='member',
related_name='memberof')
owners = meta.ManyToManyField( User, singular='owner',
related_name='ownerof')

Now I get a User.get_memberof_list() but not a User.get_ownerof_list()

It seems like the model can only handle one ManyToManyField to a given
model. This looks like a bug to me. Has anyone seen this before? Is
there a workaround?

Paul

Offline

  • Root
  • » Django
  • » Multiple ManyToManyFields to the same Model loses getters [RSS Feed]

Board footer

Moderator control

Enjoy the 22nd of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support