Skip to content

Customization with Migration #200

@maxillosoft-dimitry

Description

@maxillosoft-dimitry

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateA similar issue or PR already exists

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions