Django model, using auth_group as a ForeignKey

django-models, foreign-keys, python

Solution

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)

Problem

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.

Original source