mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2025-08-10 07:17:41 +02:00
* Added logout link/template
* Added ability for public to submit a ticket via the web if they aren't logged in * Added ability for public to view ticket via web using ticket ID & e-mail address * Added public ticket URL to e-mails * Added manager to FollowUp class to
This commit is contained in:
58
forms.py
58
forms.py
@ -102,3 +102,61 @@ class TicketForm(forms.Form):
|
||||
send_multipart_mail('helpdesk/emails/submitter_newticket', context, '%s %s' % (t.ticket, t.title), t.submitter_email, q.from_address)
|
||||
|
||||
return t
|
||||
|
||||
class PublicTicketForm(forms.Form):
|
||||
queue = forms.ChoiceField(label=u'Queue', required=True, choices=())
|
||||
|
||||
title = forms.CharField(max_length=100, required=True,
|
||||
widget=forms.TextInput(),
|
||||
label=u'Summary of your query')
|
||||
|
||||
submitter_email = forms.EmailField(required=True,
|
||||
label=u'Your E-Mail Address',
|
||||
help_text=u'We will e-mail you when your ticket is updated.')
|
||||
|
||||
body = forms.CharField(widget=forms.Textarea(),
|
||||
label=u'Description of your issue', required=True,
|
||||
help_text=u'Please be as descriptive as possible, including any details we may need to address your query.')
|
||||
|
||||
priority = forms.ChoiceField(choices=Ticket.PRIORITY_CHOICES,
|
||||
required=True,
|
||||
initial='3',
|
||||
label=u'Urgency',
|
||||
help_text=u'Please select a priority carefully.')
|
||||
|
||||
def save(self):
|
||||
"""
|
||||
Writes and returns a Ticket() object
|
||||
|
||||
"""
|
||||
q = Queue.objects.get(id=int(self.cleaned_data['queue']))
|
||||
|
||||
t = Ticket( title = self.cleaned_data['title'],
|
||||
submitter_email = self.cleaned_data['submitter_email'],
|
||||
created = datetime.now(),
|
||||
status = Ticket.OPEN_STATUS,
|
||||
queue = q,
|
||||
description = self.cleaned_data['body'],
|
||||
priority = self.cleaned_data['priority'],
|
||||
)
|
||||
|
||||
t.save()
|
||||
|
||||
f = FollowUp( ticket = t,
|
||||
title = 'Ticket Opened Via Web',
|
||||
date = datetime.now(),
|
||||
public = True,
|
||||
comment = self.cleaned_data['body'],
|
||||
)
|
||||
|
||||
f.save()
|
||||
|
||||
context = {
|
||||
'ticket': t,
|
||||
'queue': q,
|
||||
}
|
||||
|
||||
from helpdesk.lib import send_multipart_mail
|
||||
send_multipart_mail('helpdesk/emails/submitter_newticket', context, '%s %s' % (t.ticket, t.title), t.submitter_email, q.from_address)
|
||||
|
||||
return t
|
||||
|
Reference in New Issue
Block a user