admin.py 631 B

1234567891011121314151617181920212223
  1. from django.contrib import admin
  2. from .models import AlertRecipient, Notification, ProjectAlert
  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)