admin.py 424 B

12345678910111213141516
  1. from django.contrib import admin
  2. from bitfield import BitField
  3. from bitfield.forms import BitFieldCheckboxSelectMultiple
  4. from .models import APIToken
  5. @admin.register(APIToken)
  6. class APITokenAdmin(admin.ModelAdmin):
  7. raw_id_fields = ("user",)
  8. list_display = ("token", "user", "label")
  9. readonly_fields = ("token",)
  10. formfield_overrides = {
  11. BitField: {"widget": BitFieldCheckboxSelectMultiple},
  12. }