2016-12-19 07:20:48 +00:00
|
|
|
from django.contrib import admin
|
2019-07-16 02:44:03 +00:00
|
|
|
from django.forms import ModelForm
|
|
|
|
from .models import Ticket, Note
|
|
|
|
|
|
|
|
class NoteInline(admin.StackedInline):
|
|
|
|
model = Note
|
|
|
|
fields = ('created_at', 'body', 'author')
|
|
|
|
readonly_fields = ('created_at', 'body', 'author')
|
|
|
|
ordering = ('created_at',)
|
|
|
|
extra = 1
|
2016-12-19 07:20:48 +00:00
|
|
|
|
|
|
|
@admin.register(Ticket)
|
|
|
|
class TicketAdmin(admin.ModelAdmin):
|
2019-01-19 19:17:19 +00:00
|
|
|
readonly_fields = ('submitted',)
|
2019-01-19 18:46:20 +00:00
|
|
|
list_display = ('submitted', 'issue_status', 'issue_type', 'name', 'email')
|
|
|
|
list_filter = ('issue_status', 'issue_type')
|
2019-01-19 19:17:19 +00:00
|
|
|
fields = ('submitted', 'name', 'email', 'issue_status', 'issue_type', 'issue_text')
|
2019-07-16 02:44:03 +00:00
|
|
|
|
|
|
|
def save_related(request, form, formsets, change):
|
|
|
|
for formset in formsets:
|
|
|
|
import ipdb; ipdb.set_trace()
|
|
|
|
pass # TODO set author based on request
|
|
|
|
super()
|