mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-01-19 04:19:54 +01:00
Fix Issue #404: Refactor converting query string into queue:id
This commit is contained in:
parent
e5a6686c6d
commit
afbfd01fab
@ -562,6 +562,14 @@ class Ticket(models.Model):
|
|||||||
|
|
||||||
super(Ticket, self).save(*args, **kwargs)
|
super(Ticket, self).save(*args, **kwargs)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def queue_and_id_from_query(klass, query):
|
||||||
|
# Apply the opposite logic here compared to self._get_ticket_for_url
|
||||||
|
# Ensure that queues with '-' in them will work
|
||||||
|
parts = query.split('-')
|
||||||
|
queue = '-'.join(parts[0:-1])
|
||||||
|
return queue, parts[-1]
|
||||||
|
|
||||||
|
|
||||||
class FollowUpManager(models.Manager):
|
class FollowUpManager(models.Manager):
|
||||||
def private_followups(self):
|
def private_followups(self):
|
||||||
|
@ -78,10 +78,7 @@ def view_ticket(request):
|
|||||||
error_message = ''
|
error_message = ''
|
||||||
|
|
||||||
if ticket_req and email:
|
if ticket_req and email:
|
||||||
parts = ticket_req.split('-')
|
queue, ticket_id = Ticket.queue_and_id_from_query(ticket_req)
|
||||||
queue = '-'.join(parts[0:-1])
|
|
||||||
ticket_id = parts[-1]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ticket = Ticket.objects.get(id=ticket_id, submitter_email__iexact=email)
|
ticket = Ticket.objects.get(id=ticket_id, submitter_email__iexact=email)
|
||||||
except:
|
except:
|
||||||
|
@ -739,7 +739,7 @@ def ticket_list(request):
|
|||||||
filter = None
|
filter = None
|
||||||
if query.find('-') > 0:
|
if query.find('-') > 0:
|
||||||
try:
|
try:
|
||||||
queue, id = query.split('-')
|
queue, id = Ticket.queue_and_id_from_query(query)
|
||||||
id = int(id)
|
id = int(id)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
id = None
|
id = None
|
||||||
|
Loading…
Reference in New Issue
Block a user