Browse Source

better event message

mex3 2 tuần trước cách đây
mục cha
commit
704e213e21
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      views/ticket_detail.py

+ 2 - 1
views/ticket_detail.py

@@ -50,13 +50,14 @@ class TicketDetailView(LoginRequiredMixin, UserCanReadTicketMixin, DetailView):
             status = request.POST.get("ticket-status")
 
             if int(status) in ticket.get_available_statuses():
+                old_status = ticket.status
                 ticket.status = int(status)
                 ticket.save()
                 messages.success(request, f"Status successfully changed.")
                 Event.objects.create(
                     author=request.user,
                     ticket=ticket,
-                    body="Ticket status was changed"
+                    body="Ticket status was changed from "+old_status+" to "+status
                 )
             else:
                 messages.error(request, f"Status change error.")