Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
175 views
in Technique[技术] by (71.8m points)

python - Django-Admin - automatically update statusfield on inline model action

I've written a small support application to as you might already assume providing support for my users ... The problem is that if a user creates a new ticket, the status of the ticket will be set to "Waiting for Support", If a reply has been created by a staff member or so, the status does not change automatically back to "Waiting for Requester", which is pretty annoying as you can easily forgot about it. The user that has originally requested the support does not get notified if the field does not change.

at my admin.py I have the following setup:

class SupportTicketsAdmin(admin.ModelAdmin):
    list_display = ['ticket_id', 'requester', 'creation_date', 'status', 'category', 'subject']
    actions = [set_ticket_open, set_ticket_waiting_for_requester, set_ticket_waiting_for_support, set_ticket_closed]
    ordering = ['-creation_date']
    list_filter = ['creation_date']
    inlines = [
        SupportTicketRepliesInline,
    ]


admin.site.register(SupportTickets, SupportTicketsAdmin)

Is it maybe possible to use signals here?

Thanks in advance

question from:https://stackoverflow.com/questions/65893569/django-admin-automatically-update-statusfield-on-inline-model-action

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...