UUID instead of int OR --> RuntimeError: Model class organizations.models.Organization doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
apowell656 opened this issue · comments
All I want to do is use a UUID instead of an int for PK. After reading how to use customized models and seeing this issue to know it can be done I am unable to make or apply migrations.
I have the following structure:
myApp
|models
|organizations
| init.py
| models.py
etc.
And models.py has the following:
` import uuid
from django.db import models
from organizations.abstract import (AbstractOrganization, AbstractOrganizationOwner, AbstractOrganizationUser)
class Organization(AbstractOrganization):
id = models.UUIDField(default=uuid.uuid4(), editable=False, primary_key=True)
class Meta:
app_label = 'myApp'
class OrganizationOwner(AbstractOrganizationOwner):
id = models.UUIDField(default=uuid.uuid4(), editable=False, primary_key=True)
class Meta:
app_label = 'myApp'
class OrganizationUser(AbstractOrganizationUser):
id = models.UUIDField(default=uuid.uuid4(), editable=False, primary_key=True)
class Meta:
app_label = 'myApp' `
When running makemigrations the following error is produced:
RuntimeError: Model class organizations.models.Organization doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
I am just trying to use UUIDs instead of simple ids in my app. What am I missing? Previously, I was able to override a view with no issue, and now I just want to create my own tables, etc.
My solution fork the project and make the changes. I guess this is a workaround, but I believe the documentation could/should be a little clearer on how to accomplish this.