From 11b0906bd52a7f46194cd2f00011725461f8c626 Mon Sep 17 00:00:00 2001 From: dfirst Date: Mon, 19 Aug 2024 14:26:32 +0300 Subject: [PATCH] Make rest_framework_api_key app optional to include into INSTALLED_APPS The reason: https://github.com/florimondmanca/djangorestframework-api-key/issues/180 --- src/rest_framework_api_key/admin.py | 5 ----- src/rest_framework_api_key/models.py | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/rest_framework_api_key/admin.py b/src/rest_framework_api_key/admin.py index a368b45..2a04d78 100644 --- a/src/rest_framework_api_key/admin.py +++ b/src/rest_framework_api_key/admin.py @@ -54,8 +54,3 @@ def save_model( messages.add_message(request, messages.WARNING, message) else: obj.save() - - -admin.site.register(APIKey, APIKeyModelAdmin) - -APIKeyAdmin = APIKeyModelAdmin # Compatibility with <1.3 diff --git a/src/rest_framework_api_key/models.py b/src/rest_framework_api_key/models.py index 034ea6d..55b7c53 100644 --- a/src/rest_framework_api_key/models.py +++ b/src/rest_framework_api_key/models.py @@ -109,6 +109,7 @@ class AbstractAPIKey(models.Model): class Meta: # noqa abstract = True + app_label = 'rest_framework_api_key' ordering = ("-created",) verbose_name = "API key" verbose_name_plural = "API keys"