models.py 437 B

123456789101112
  1. from django.db import models
  2. from rest_framework_api_key.models import AbstractAPIKey, BaseAPIKeyManager
  3. from django.contrib.auth.models import User, Permission
  4. from django.contrib import contenttypes
  5. class APIKey(AbstractAPIKey):
  6. permission = models.ManyToManyField(Permission, related_name="api_keys")
  7. class Meta(AbstractAPIKey.Meta):
  8. verbose_name = "API key"
  9. verbose_name_plural = "API keys"