I have two models in separate apps:
# Groups app
class Group(models.Model):
name = models.CharField(max_length=256)
abbreviation = models.CharField(max_length=32)
admin = models.ManyToManyField('UserProfile')
# UserProfile app
class UserProfile(models.Model):
user = models.OneToOneField(User)
groups = models.ManyToManyField(Group)
In other words, a user may belong to several groups (User M2M to Groups), and also a group may have one or more administratrators (Group M2M to Users). I am having trouble with doing a syncdb here because of this. What would be the best way to proceed here? Should I 1) combine Groups into the UserProfile app? or 2) user ALTER TABLE statements after the fact to make one of the M2M links? or 3) Something else?
https://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey