Custom API key model w/o default `APIKey` table or admin
See original GitHub issueI would like to be able to inherit AbstractAPIKey directly from the model, without having to reference it via foreignkey, and also I would like django, to not create these tables at all:
class APIKey(AbstractAPIKey):
pass
I would like to: Inherit the Abstract class, without having to reference the model.
I would solve it by: Not installing the app at all, if we migrated the code of the abstract base class away from models.py, we would be able to inherit without problems.
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Authenticate using API keys - Google Cloud
This page describes how to use API keys to authenticate to Google Cloud APIs and services that support API keys. Most Google Cloud...
Read more >User Guide - Django REST Framework API Key - GitHub Pages
The APIKey model as well as custom API keys models inherited from AbstractAPIKey have a dedicated manager which is responsible for implementing .create_key() ......
Read more >Use API Keys | Maps JavaScript API - Google Developers
Create API keys The API key is a unique identifier that authenticates requests associated with your project for usage and billing purposes. You...
Read more >API keys | Grafana documentation
This section contains information about API keys in Grafana. ... Admin: Enables a user to use APIs at the broadest, most powerful administrative...
Read more >Issues · florimondmanca/djangorestframework-api-key - GitHub
API key permissions for Django REST Framework. ... Import not working ... Custom API key model w/o default APIKey table or admin question...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have a similar need here. Would like to
Not installing the app causes a similar error as discussion above:
RuntimeError: Model class rest_framework_api_key.models.APIKey doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Is there a way to do that?
Thanks!
I think we’d also want to remove the
admin.site.register(APIKey, APIKeyModelAdmin)
call inrest_framework_api_key/admin.py
, and have users explicitly register the defaultAPIKey
if they’d like. It could be done as a first step so users don’t seeAPIKey
if they don’t want to, but also if we decide to have a swappableAPI_KEY_MODEL
setting, that’d be required as otherwise we’d be registering a model from a different app, which isn’t desirable (and could lead to conflicts).