|
@@ -1,14 +1,28 @@
|
|
from django.contrib import admin
|
|
from django.contrib import admin
|
|
|
|
+from django.utils.safestring import mark_safe
|
|
|
|
|
|
-from tickets.models import Attachment, Comment, TicketList, Ticket
|
|
|
|
|
|
+from tickets.models import Attachment, Comment, TicketList, Ticket, TicketArchive
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+class TicketListAdmin(admin.ModelAdmin):
|
|
|
|
+ list_filter = ("group",)
|
|
|
|
|
|
|
|
|
|
class TicketAdmin(admin.ModelAdmin):
|
|
class TicketAdmin(admin.ModelAdmin):
|
|
- list_display = ("title", "ticket_list", "ticket_type", "status", "priority", "created_at", "due_date")
|
|
|
|
- list_filter = ("ticket_list", "ticket_type",)
|
|
|
|
|
|
+ list_display = ("title", "ticket_list", "status", "created_by", "assigned_to", "created_at", "updated_at", "due_date", "priority")
|
|
|
|
+ list_filter =("ticket_list", "status", "created_by", "assigned_to", "created_at", "updated_at")
|
|
ordering = ("priority",)
|
|
ordering = ("priority",)
|
|
search_fields = ("title", "note")
|
|
search_fields = ("title", "note")
|
|
|
|
|
|
|
|
+class TicketArchiveAdmin(admin.ModelAdmin):
|
|
|
|
+ list_display = ("title", "ticket_list", "status", "created_by", "assigned_to", "created_at", "updated_at", "due_date")
|
|
|
|
+ list_filter = ("ticket_list", "status", "created_by", "assigned_to", "created_at", "updated_at")
|
|
|
|
+ search_fields = ("title", "note")
|
|
|
|
+ readonly_fields = ("title", "ticket_list", "ticket_type", "status", "created_at", "updated_at", "due_date", "created_by", "assigned_to", "display_note")
|
|
|
|
+
|
|
|
|
+ def display_note(self, obj):
|
|
|
|
+ return mark_safe(obj.note)
|
|
|
|
+
|
|
|
|
|
|
class CommentAdmin(admin.ModelAdmin):
|
|
class CommentAdmin(admin.ModelAdmin):
|
|
list_display = ("author", "date", "snippet")
|
|
list_display = ("author", "date", "snippet")
|
|
@@ -19,7 +33,8 @@ class AttachmentAdmin(admin.ModelAdmin):
|
|
autocomplete_fields = ["added_by", "ticket"]
|
|
autocomplete_fields = ["added_by", "ticket"]
|
|
|
|
|
|
|
|
|
|
-admin.site.register(TicketList)
|
|
|
|
-admin.site.register(Comment, CommentAdmin)
|
|
|
|
|
|
+admin.site.register(TicketList, TicketListAdmin)
|
|
admin.site.register(Ticket, TicketAdmin)
|
|
admin.site.register(Ticket, TicketAdmin)
|
|
-admin.site.register(Attachment, AttachmentAdmin)
|
|
|
|
|
|
+admin.site.register(TicketArchive, TicketArchiveAdmin)
|
|
|
|
+admin.site.register(Comment, CommentAdmin)
|
|
|
|
+admin.site.register(Attachment, AttachmentAdmin)
|