Fix bug where opening & assigning in one go didn't work.

This commit is contained in:
Ross Poulton 2007-12-28 03:38:39 +00:00
parent 20ede72e59
commit 3fccc19af8

View File

@ -29,6 +29,7 @@ $Id$
from django import newforms as forms
from helpdesk.models import Ticket, Queue, FollowUp
from django.contrib.auth.models import User
from datetime import datetime
class TicketForm(forms.Form):
@ -61,7 +62,11 @@ class TicketForm(forms.Form):
description = self.cleaned_data['body'],
)
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()
f = FollowUp( ticket=t,
@ -72,7 +77,7 @@ class TicketForm(forms.Form):
user=user,
)
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()