You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read the documentation and created similar customization such as:
organizations/models.py
from django.db import models
from rest_framework_api_key.models import AbstractAPIKey
class Organization(models.Model):
name = models.CharField(max_length=128)
active = models.BooleanField(default=True)
class OrganizationAPIKey(AbstractAPIKey):
organization = models.ForeignKey(
Organization,
on_delete=models.CASCADE,
related_name="api_keys",
)
class OrganizationAPIKey(AbstractAPIKey):
some code specific to the project
class Meta(AbstractAPIKey.Meta):
verbose_name = "Organization API key"
verbose_name_plural = "Organization API keys"
When I run ./manage.py migrate rest_framework_api_key, I thought it should only create the OrganizationAPIKey table but it also creates the rest_framework_api_key_apikey table in mysql. On https://docs.djangoproject.com/en/2.2/topics/db/models/#abstract-base-classes, it says that abstract classes do not get created when class Meta: abstract = true and I see that in the AbstractAPIKey class.
Any ideas what I am doing wrong?
Thanks
-Dimitry
The text was updated successfully, but these errors were encountered:
I read the documentation and created similar customization such as:
organizations/models.py
from django.db import models
from rest_framework_api_key.models import AbstractAPIKey
class Organization(models.Model):
name = models.CharField(max_length=128)
active = models.BooleanField(default=True)
class OrganizationAPIKey(AbstractAPIKey):
organization = models.ForeignKey(
Organization,
on_delete=models.CASCADE,
related_name="api_keys",
)
class OrganizationAPIKey(AbstractAPIKey):
some code specific to the project
class Meta(AbstractAPIKey.Meta):
verbose_name = "Organization API key"
verbose_name_plural = "Organization API keys"
When I run ./manage.py migrate rest_framework_api_key, I thought it should only create the OrganizationAPIKey table but it also creates the rest_framework_api_key_apikey table in mysql. On https://docs.djangoproject.com/en/2.2/topics/db/models/#abstract-base-classes, it says that abstract classes do not get created when class Meta: abstract = true and I see that in the AbstractAPIKey class.
Any ideas what I am doing wrong?
Thanks
-Dimitry
The text was updated successfully, but these errors were encountered: