feat: added material to model and form

This commit is contained in:
2025-05-31 22:47:43 +02:00
parent f5d2550000
commit a9e32034a7
5 changed files with 98 additions and 60 deletions

View File

@@ -85,7 +85,11 @@ class TicketDetailUpdateView(UpdateView):
is_assigned_tutor = user == self.ticket.assigned_to
is_superuser = user.is_superuser
self.can_edit = is_assigned_tutor or is_superuser
# Nur Autor und Admin kann Tickets bearbeiten
if self.ticket.status == "closed" and not is_superuser:
self.can_edit = False
else:
self.can_edit = is_assigned_tutor or is_superuser
# Zusätzliche Flags für Template
self.is_creator = is_creator
@@ -122,7 +126,7 @@ class TicketDetailUpdateView(UpdateView):
response = super().form_valid(form) # Speichert das Ticket
# History tracking für geänderte Felder
tracked_fields = ["title", "description", "status", "priority", "course", "answer"]
tracked_fields = ["title", "description", "status", "priority", "course", "answer", "material"]
for field in tracked_fields:
if field in form.changed_data:
old_value = getattr(original, field)