forked from extern/django-helpdesk
Fix bug where opening & assigning in one go didn't work.
This commit is contained in:
parent
20ede72e59
commit
3fccc19af8
9
forms.py
9
forms.py
@ -29,6 +29,7 @@ $Id$
|
|||||||
|
|
||||||
from django import newforms as forms
|
from django import newforms as forms
|
||||||
from helpdesk.models import Ticket, Queue, FollowUp
|
from helpdesk.models import Ticket, Queue, FollowUp
|
||||||
|
from django.contrib.auth.models import User
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
class TicketForm(forms.Form):
|
class TicketForm(forms.Form):
|
||||||
@ -61,7 +62,11 @@ class TicketForm(forms.Form):
|
|||||||
description = self.cleaned_data['body'],
|
description = self.cleaned_data['body'],
|
||||||
)
|
)
|
||||||
if self.cleaned_data['assigned_to']:
|
if self.cleaned_data['assigned_to']:
|
||||||
t.assigned_to = self.cleaned_data['assigned_to']
|
try:
|
||||||
|
u = User.objects.get(id=self.cleaned_data['assigned_to'])
|
||||||
|
t.assigned_to = u
|
||||||
|
except:
|
||||||
|
t.assigned_to = None
|
||||||
t.save()
|
t.save()
|
||||||
|
|
||||||
f = FollowUp( ticket=t,
|
f = FollowUp( ticket=t,
|
||||||
@ -72,7 +77,7 @@ class TicketForm(forms.Form):
|
|||||||
user=user,
|
user=user,
|
||||||
)
|
)
|
||||||
if self.cleaned_data['assigned_to']:
|
if self.cleaned_data['assigned_to']:
|
||||||
f.title = 'Ticket Opened & Assigned to %s' % self.cleaned_data['assigned_to']
|
f.title = 'Ticket Opened & Assigned to %s' % t.get_assigned_to
|
||||||
|
|
||||||
f.save()
|
f.save()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user