emile 12 months ago
parent c22db8adcf
commit 893acd6a8c

@ -8,7 +8,9 @@ from django.http import Http404
def ticket_room(request, ticket_number): def ticket_room(request, ticket_number):
ticket = get_object_or_404(Ticket, ticket_number=ticket_number) ticket = get_object_or_404(Ticket, ticket_number=ticket_number)
if hasattr(request.user, 'customerprofile') and request.user.customerprofile == ticket.customer: if request.user.is_superuser:
base_template = "main.html"
elif hasattr(request.user, 'customerprofile') and request.user.customerprofile == ticket.customer:
base_template = "customer_main.html" base_template = "customer_main.html"
elif hasattr(request.user, 'staffprofile'): elif hasattr(request.user, 'staffprofile'):
latest_department = TicketDepartment.objects.filter(ticket=ticket).order_by('-date_added').first() latest_department = TicketDepartment.objects.filter(ticket=ticket).order_by('-date_added').first()
@ -20,8 +22,6 @@ def ticket_room(request, ticket_number):
base_template = "main.html" base_template = "main.html"
else: else:
raise Http404("You are not authorized to view this ticket.") raise Http404("You are not authorized to view this ticket.")
elif request.user.is_superuser:
base_template = "main.html"
else: else:
raise Http404("You are not authorized to view this ticket.") raise Http404("You are not authorized to view this ticket.")

Loading…
Cancel
Save