Skip to content

Instantly share code, notes, and snippets.

@zgohr
Last active April 17, 2019 10:01
Show Gist options
  • Save zgohr/4490410 to your computer and use it in GitHub Desktop.
Save zgohr/4490410 to your computer and use it in GitHub Desktop.
Remove Tastypie from Django admin
from django.contrib import admin
from tastypie.models import ApiKey, ApiAccess
admin.site.unregister(ApiKey)
admin.site.unregister(ApiAccess)
@rshorey
Copy link

rshorey commented Jan 13, 2016

When I tried this, I got:

django.contrib.admin.sites.NotRegistered: The model ApiKey is not registered

Then I tried registering ApiKey just for fun, and got:

django.contrib.admin.sites.AlreadyRegistered: The model ApiKey is already registered

Eventually I was able to remove api keys from admin by adding the following to my settings.py:

TASTYPIE_ABSTRACT_APIKEY = True

based on this chunk of django-tastypie source.

I'm running the following versions:
Django==1.8.4
django-tastypie==0.12.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment