admin.py 776 B

12345678910111213141516171819202122232425
  1. from django.contrib import admin
  2. from tickets.models import Attachment, Comment, TicketList, Ticket
  3. class TicketAdmin(admin.ModelAdmin):
  4. list_display = ("title", "ticket_list", "ticket_type", "status", "priority", "created_at", "due_date")
  5. list_filter = ("ticket_list", "ticket_type",)
  6. ordering = ("priority",)
  7. search_fields = ("title", "note")
  8. class CommentAdmin(admin.ModelAdmin):
  9. list_display = ("author", "date", "snippet")
  10. class AttachmentAdmin(admin.ModelAdmin):
  11. list_display = ("ticket", "added_by", "timestamp", "file")
  12. autocomplete_fields = ["added_by", "ticket"]
  13. admin.site.register(TicketList)
  14. admin.site.register(Comment, CommentAdmin)
  15. admin.site.register(Ticket, TicketAdmin)
  16. admin.site.register(Attachment, AttachmentAdmin)