From 30a577e18b81bc06d5e802143b09698176e98ff9 Mon Sep 17 00:00:00 2001 From: satyans24 Date: Mon, 23 Jul 2012 12:38:26 +0530 Subject: [PATCH] Update helpdesk/views/staff.py --- helpdesk/views/staff.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 8f5e2e24..20cf0a42 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -39,7 +39,10 @@ if helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE: # treat 'normal' users like 'staff' staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active) else: - staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_staff) + try: + from django.contrib.admin.views.decorators import staff_member_required + except: + staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_staff) superuser_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_superuser) @@ -747,7 +750,7 @@ def ticket_list(request): context, query_string=querydict.urlencode(), tickets=tickets, - user_choices=User.objects.filter(is_active=True), + user_choices=User.objects.filter(is_active=True,is_staff=True), queue_choices=Queue.objects.all(), status_choices=Ticket.STATUS_CHOICES, tag_choices=tag_choices, @@ -783,7 +786,7 @@ def create_ticket(request): if request.method == 'POST': form = TicketForm(request.POST, request.FILES) form.fields['queue'].choices = [('', '--------')] + [[q.id, q.title] for q in Queue.objects.all()] - form.fields['assigned_to'].choices = [('', '--------')] + [[u.id, u.username] for u in User.objects.filter(is_active=True).order_by('username')] + form.fields['assigned_to'].choices = [('', '--------')] + [[u.id, u.username] for u in User.objects.filter(is_active=True,is_staff=True).order_by('username')] if form.is_valid(): ticket = form.save(user=request.user) return HttpResponseRedirect(ticket.get_absolute_url())