admin.py 418 B

123456789101112131415161718
  1. from django.contrib import admin
  2. from .models import Project, ProjectKey
  3. class ProjectKeyInline(admin.StackedInline):
  4. model = ProjectKey
  5. extra = 0
  6. readonly_fields = ("dsn",)
  7. class ProjectAdmin(admin.ModelAdmin):
  8. search_fields = ("name",)
  9. list_display = ("name", "organization")
  10. raw_id_fields = ("organization",)
  11. inlines = [ProjectKeyInline]
  12. admin.site.register(Project, ProjectAdmin)