0

Does anyone know if it is possible to add a field to the intermediatary auth_user_group table? I'd like to have a manager flag to identify a user that is a member of a group as a group manager (the permissions for this will be handled separately), but this relationship seems obfuscated by Django.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Mike91
  • 520
  • 2
  • 9
  • 25

1 Answers1

1

I would probably create a GroupManager model to handle this.

class UserGroupManager(models.Model):
    user = models.ForeignKey(User, limit_choices_to={'groups__name': "some-group"})
    group = models.ForeignKey(Group)
Gustavo Reyes
  • 1,313
  • 1
  • 17
  • 31
  • Thanks Gustavo. I have implemented something similar. It is a shame that Django abstracts the User <-> Group ManyToMany relationship away in the PermissionMixin, as subclassing and overriding this can become quite hacky and complicated! – Mike91 Feb 13 '17 at 20:37