from django.db import models from rest_framework_api_key.models import AbstractAPIKey, BaseAPIKeyManager from django.contrib.auth.models import User, Permission from django.contrib import contenttypes class APIKey(AbstractAPIKey): permission = models.ManyToManyField(Permission, related_name="api_keys") class Meta(AbstractAPIKey.Meta): verbose_name = "API key" verbose_name_plural = "API keys"