admin.py 461 B

1234567891011121314151617181920
  1. from django.contrib import admin
  2. from rest_framework_api_key.admin import APIKeyModelAdmin
  3. from rest_framework_api_key.models import APIKey as APIKey_default
  4. from .models import APIKey
  5. from django.contrib.auth.models import Permission
  6. admin.site.unregister(APIKey_default)
  7. admin.site.register(Permission)
  8. @admin.register(APIKey)
  9. class ClientAPIKeyModelAdmin(APIKeyModelAdmin):
  10. filter_horizontal = ['permission']
  11. pass
  12. #admin.site.register(APIKey)