{% else %}
@@ -105,13 +121,9 @@
{% if not view.can_edit or ticket.status != 'resolved' %}disabled{% endif %}
placeholder="Beschreibe die Lösung des Problems..."
class="w-full p-2 border border-gray-300 rounded shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 placeholder:text-black {% if not view.can_edit or ticket.status != 'resolved' %}bg-gray-100 cursor-not-allowed{% endif %}">{{ ticket.answer|default:'' }}
- {% if form.answer.errors %}
-
{{ form.answer.errors }}
- {% endif %}
+ {% if form.answer.errors %}
{{ form.answer.errors }}
{% endif %}
- {% if ticket.status != 'resolved' %}
- Eine Antwort ist erforderlich beim Setzen des Status auf "Gelöst"
- {% endif %}
+ {% if ticket.status != 'resolved' %}Eine Antwort ist erforderlich beim Setzen des Status auf "Gelöst"{% endif %}
{% endif %}
@@ -181,7 +193,6 @@
class="text-blue-500 hover:text-blue-600">← Zurück zur Übersicht
-
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/ticketsystem/templates/ticketsystem/ticket_form.html b/ticketsystem/templates/ticketsystem/ticket_form.html
index 9808921..a2855ff 100644
--- a/ticketsystem/templates/ticketsystem/ticket_form.html
+++ b/ticketsystem/templates/ticketsystem/ticket_form.html
@@ -44,19 +44,38 @@
{{ form.description.errors }}
{% endif %}
-
-
-
- {% if form.course.errors %}
{{ form.course.errors }}
{% endif %}
+
+
+
+
+
+ {% if form.course.errors %}
{{ form.course.errors }}
{% endif %}
+
+
+
+
+ {% if form.course.errors %}
{{ form.course.errors }}
{% endif %}
+
@@ -77,13 +96,10 @@
{% if form.priority.errors %}
{{ form.priority.errors }}
{% endif %}
@@ -91,7 +107,8 @@
-
+
Bitte Kurs auswählen
Wird automatisch basierend auf dem ausgewählten Kurs zugewiesen
@@ -123,7 +140,6 @@
-
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/ticketsystem/views.py b/ticketsystem/views.py
index b818492..777fa9a 100644
--- a/ticketsystem/views.py
+++ b/ticketsystem/views.py
@@ -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)