I would like to use the auth_group
table as a foreign key in my custom model :
class MyModel(models.Model):
field = models.ForeignKey(auth_group)
I cant find a mention on how to reference this table.
I've seen settings.AUTH_USER_MODEL
, but couldnt see anything for auth_group
Any pointers would be appreciated.
The table auth_group
is referenced by the Group
model of the auth
app, with default naming.
So to make a ForeignKey to an object in that table your model would be:
from django.contrib.auth.models import Group
class MyModel(models.Model):
field = models.ForeignKey(Group)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With