mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-20 17:47:58 +02:00
fixing views.py (except deprecated api)
This commit is contained in:
parent
0159ca1ffa
commit
3c35473265
@ -168,4 +168,3 @@ class OpenTicketsByQueue(Feed):
|
|||||||
return item.assigned_to.get_username()
|
return item.assigned_to.get_username()
|
||||||
else:
|
else:
|
||||||
return _('Unassigned')
|
return _('Unassigned')
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ def followup_edit(request, ticket_id, followup_id):
|
|||||||
new_followup.user = followup.user
|
new_followup.user = followup.user
|
||||||
new_followup.save()
|
new_followup.save()
|
||||||
# get list of old attachments & link them to new_followup
|
# get list of old attachments & link them to new_followup
|
||||||
attachments = Attachment.objects.filter(followup = followup)
|
attachments = Attachment.objects.filter(followup=followup)
|
||||||
for attachment in attachments:
|
for attachment in attachments:
|
||||||
attachment.followup = new_followup
|
attachment.followup = new_followup
|
||||||
attachment.save()
|
attachment.save()
|
||||||
@ -299,7 +299,6 @@ def view_ticket(request, ticket_id):
|
|||||||
else:
|
else:
|
||||||
users = User.objects.filter(is_active=True).order_by(User.USERNAME_FIELD)
|
users = User.objects.filter(is_active=True).order_by(User.USERNAME_FIELD)
|
||||||
|
|
||||||
|
|
||||||
# TODO: shouldn't this template get a form to begin with?
|
# TODO: shouldn't this template get a form to begin with?
|
||||||
form = TicketForm(initial={'due_date': ticket.due_date})
|
form = TicketForm(initial={'due_date': ticket.due_date})
|
||||||
|
|
||||||
@ -521,7 +520,7 @@ def update_ticket(request, ticket_id, public=False):
|
|||||||
c.save()
|
c.save()
|
||||||
ticket.due_date = due_date
|
ticket.due_date = due_date
|
||||||
|
|
||||||
if new_status in [ Ticket.RESOLVED_STATUS, Ticket.CLOSED_STATUS ]:
|
if new_status in (Ticket.RESOLVED_STATUS, Ticket.CLOSED_STATUS):
|
||||||
if new_status == Ticket.RESOLVED_STATUS or ticket.resolution is None:
|
if new_status == Ticket.RESOLVED_STATUS or ticket.resolution is None:
|
||||||
ticket.resolution = comment
|
ticket.resolution = comment
|
||||||
|
|
||||||
@ -831,13 +830,12 @@ def ticket_list(request):
|
|||||||
# Query deserialization failed. (E.g. was a pickled query)
|
# Query deserialization failed. (E.g. was a pickled query)
|
||||||
return HttpResponseRedirect(reverse('helpdesk_list'))
|
return HttpResponseRedirect(reverse('helpdesk_list'))
|
||||||
|
|
||||||
elif not ('queue' in request.GET
|
elif not ('queue' in request.GET or
|
||||||
or 'assigned_to' in request.GET
|
'assigned_to' in request.GET or
|
||||||
or 'status' in request.GET
|
'status' in request.GET or
|
||||||
or 'q' in request.GET
|
'q' in request.GET or
|
||||||
or 'sort' in request.GET
|
'sort' in request.GET or
|
||||||
or 'sortreverse' in request.GET
|
'sortreverse' in request.GET):
|
||||||
):
|
|
||||||
|
|
||||||
# Fall-back if no querying is being done, force the list to only
|
# Fall-back if no querying is being done, force the list to only
|
||||||
# show open/reopened/resolved (not closed) cases sorted by creation
|
# show open/reopened/resolved (not closed) cases sorted by creation
|
||||||
@ -1113,7 +1111,8 @@ def run_report(request, report):
|
|||||||
# a second table for more complex queries
|
# a second table for more complex queries
|
||||||
summarytable2 = defaultdict(int)
|
summarytable2 = defaultdict(int)
|
||||||
|
|
||||||
month_name = lambda m: MONTHS_3[m].title()
|
def month_name(m):
|
||||||
|
MONTHS_3[m].title()
|
||||||
|
|
||||||
first_ticket = Ticket.objects.all().order_by('created')[0]
|
first_ticket = Ticket.objects.all().order_by('created')[0]
|
||||||
first_month = first_ticket.created.month
|
first_month = first_ticket.created.month
|
||||||
@ -1501,7 +1500,7 @@ def days_since_created(today, ticket):
|
|||||||
|
|
||||||
|
|
||||||
def date_rel_to_today(today, offset):
|
def date_rel_to_today(today, offset):
|
||||||
return today - timedelta(days = offset)
|
return today - timedelta(days=offset)
|
||||||
|
|
||||||
|
|
||||||
def sort_string(begin, end):
|
def sort_string(begin, end):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user