42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
from django.contrib import admin
|
|
from django.utils.translation import gettext_lazy as _
|
|
from .models import (
|
|
BugReport, BugReportImage, BugReportAttachment,
|
|
BugReportComment, BugReportCommentImage, BugReportCommentAttachment
|
|
)
|
|
|
|
|
|
class BugReportImageInline(admin.TabularInline):
|
|
model = BugReportImage
|
|
extra = 0
|
|
|
|
|
|
class BugReportAttachmentInline(admin.TabularInline):
|
|
model = BugReportAttachment
|
|
extra = 0
|
|
|
|
|
|
@admin.register(BugReport)
|
|
class BugReportAdmin(admin.ModelAdmin):
|
|
list_display = ['title', 'user', 'bug_type', 'priority', 'status', 'created_at']
|
|
list_filter = ['status', 'priority', 'bug_type']
|
|
search_fields = ['title', 'description']
|
|
inlines = [BugReportImageInline, BugReportAttachmentInline]
|
|
|
|
|
|
class BugReportCommentImageInline(admin.TabularInline):
|
|
model = BugReportCommentImage
|
|
extra = 0
|
|
|
|
|
|
class BugReportCommentAttachmentInline(admin.TabularInline):
|
|
model = BugReportCommentAttachment
|
|
extra = 0
|
|
|
|
|
|
@admin.register(BugReportComment)
|
|
class BugReportCommentAdmin(admin.ModelAdmin):
|
|
list_display = ['bug_report', 'user', 'is_admin', 'created_at']
|
|
list_filter = ['is_admin']
|
|
inlines = [BugReportCommentImageInline, BugReportCommentAttachmentInline]
|