I've extended the standard User
with a Profile
model using a one-to-one relationship:
class Profile(models.Model):
user = models.OneToOneField(User, primary_key=True, editable=False)
# Additional user information fields
This is in an app called account_custom
. The issue is that in the admin site, I would like this model to show up along with User
under "Authentication and Authorization".
I was able to make this show up in the right place in the admin by setting Meta.app_label
:
class Profile(models.Model):
class Meta:
app_label = 'auth'
db_table = 'account_custom_profile'
I set Meta.db_table
so this uses the existing database table, and everything seems to function properly.
The problem is that Django wants to generate migrations for this, one in account_custom
to delete the table and one in auth
to create it again. I'm guessing this would either fail or wipe out the data depending on the order the migrations are run, but the deeper problem is that it's trying to create a migration in auth
which isn't part of my code base.
Is there a way around this, or is there some better way to control where a ModelAdmin
shows up in the admin site?