admin.py 630 B

12345678910111213141516171819202122
  1. from django.contrib import admin
  2. from .models import Notification, ProjectAlert, AlertRecipient
  3. class NotificationAdmin(admin.ModelAdmin):
  4. readonly_fields = ("created", "project_alert", "is_sent", "issues")
  5. class AlertRecipientInline(admin.TabularInline):
  6. model = AlertRecipient
  7. extra = 0
  8. class ProjectAlertAdmin(admin.ModelAdmin):
  9. search_fields = ("project__name",)
  10. list_display = ("project", "timespan_minutes", "quantity")
  11. raw_id_fields = ("project",)
  12. inlines = [AlertRecipientInline]
  13. admin.site.register(Notification, NotificationAdmin)
  14. admin.site.register(ProjectAlert, ProjectAlertAdmin)