Update external ticketing system
This commit is contained in:
parent
cc1a48ee6f
commit
b361abeaf6
3 changed files with 68 additions and 55 deletions
|
@ -63,16 +63,21 @@ class AddExternalItemForm(ModelForm):
|
||||||
"""Form to allow users who are not part of the GTD system to file a ticket."""
|
"""Form to allow users who are not part of the GTD system to file a ticket."""
|
||||||
|
|
||||||
title = forms.CharField(
|
title = forms.CharField(
|
||||||
widget=forms.widgets.TextInput(attrs={'size': 35})
|
widget=forms.widgets.TextInput(attrs={'size': 35}),
|
||||||
|
label="Summary"
|
||||||
)
|
)
|
||||||
note = forms.CharField(
|
note = forms.CharField(
|
||||||
widget=forms.widgets.Textarea(),
|
widget=forms.widgets.Textarea(),
|
||||||
help_text='Please describe the issue.',
|
label='Problem Description',
|
||||||
|
)
|
||||||
|
priority = forms.IntegerField(
|
||||||
|
widget=forms.HiddenInput(),
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Item
|
model = Item
|
||||||
exclude = ('task_list', 'created_date', 'due_date', 'created_by', 'assigned_to',)
|
exclude = (
|
||||||
|
'task_list', 'created_date', 'due_date', 'created_by', 'assigned_to', 'completed', 'completed_date', )
|
||||||
|
|
||||||
|
|
||||||
class SearchForm(forms.Form):
|
class SearchForm(forms.Form):
|
||||||
|
|
|
@ -4,56 +4,61 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h2>{{ task }}</h2>
|
<h2>{{ task }}</h2>
|
||||||
|
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
{% if task.note %}
|
{% comment %}
|
||||||
<div class="task_note"><strong>Note:</strong> {{ task.note|safe|urlize|linebreaks }}</div>
|
|
||||||
{% endif %}
|
{% if task.note %}
|
||||||
|
<div class="task_note">
|
||||||
|
<strong>Note:</strong>
|
||||||
|
{{ task.note|safe|urlize|linebreaks }}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div id="TaskEdit">
|
<h3>File Trouble Ticket</h3>
|
||||||
<h3>File Trouble Ticket</h3>
|
<p>Do you have a support issue?
|
||||||
<p>Do you have a support issue? <br />
|
<br/>
|
||||||
Use this form to report the difficulty - we'll get right back to you. </p>
|
Use this form to report the difficulty - we'll get right back to you.
|
||||||
|
</p>
|
||||||
|
|
||||||
{% if form.errors %}
|
{% if form.errors %}
|
||||||
|
{% for error in form.errors %}
|
||||||
|
<ul class="errorlist">
|
||||||
|
<li>
|
||||||
|
<strong>The
|
||||||
|
{{ error|escape }}
|
||||||
|
field is required.</strong>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% for error in form.errors %}
|
<table>
|
||||||
<ul class="errorlist">
|
<tr>
|
||||||
<li><strong>The {{ error|escape }} field is required.</strong></li>
|
<td>Summary:</td>
|
||||||
</ul>
|
<td>{{ form.title }}
|
||||||
{% endfor %}
|
<br/>
|
||||||
<br />
|
Include the workstation number in your summary, e.g.
|
||||||
|
<br/>
|
||||||
|
"Radio Lab # 4: Purple smoke pouring out the back."
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
{% endif %}
|
<tr>
|
||||||
|
<td valign="top">Note:</td>
|
||||||
|
<td valign="top">{{ form.note }}<br/>
|
||||||
|
Please describe the problem.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<table>
|
</table>
|
||||||
<tr>
|
<p><input type="submit" class="todo-button" name="add_task" value="Submit"></p>
|
||||||
<td>Summary:</td>
|
{% endcomment %}
|
||||||
<td>{{ form.title }} <br />
|
|
||||||
Include the workstation number in your summary, e.g. <br />
|
|
||||||
"Radio Lab # 4: Purple smoke pouring out the back."
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
{{ form.as_p }}
|
||||||
<td valign="top">Note:</td>
|
<p><input type="submit" class="todo-button" name="add_task" value="Submit"></p>
|
||||||
<td valign="top">{{ form.note }}<br />
|
|
||||||
Please describe the problem.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
</form>
|
||||||
<td>Priority:</td>
|
{% endblock %}
|
||||||
<td>{{ form.priority }} <br />
|
|
||||||
Enter a number between 1 and 5, <br />
|
|
||||||
where 5 is highest ("Computer is on fire = True").
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<p><input type="submit" class="todo-button" name="add_task" value="Submit"></p>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
|
@ -315,19 +315,22 @@ def external_add(request):
|
||||||
item.assigned_to = User.objects.get(username=settings.DEFAULT_ASSIGNEE)
|
item.assigned_to = User.objects.get(username=settings.DEFAULT_ASSIGNEE)
|
||||||
item.save()
|
item.save()
|
||||||
|
|
||||||
email_subject = render_to_string("todo/email/assigned_subject.txt", {'task': item.title})
|
# Send email to assignee if we have one
|
||||||
email_body = render_to_string("todo/email/assigned_body.txt", {'task': item, 'site': current_site, })
|
if item.assigned_to:
|
||||||
try:
|
email_subject = render_to_string("todo/email/assigned_subject.txt", {'task': item.title})
|
||||||
send_mail(
|
email_body = render_to_string("todo/email/assigned_body.txt", {'task': item, 'site': current_site, })
|
||||||
email_subject, email_body, item.created_by.email, [item.assigned_to.email, ], fail_silently=False)
|
try:
|
||||||
except ConnectionRefusedError:
|
send_mail(
|
||||||
messages.error(request, "Task saved but mail not sent. Contact your administrator.")
|
email_subject, email_body, item.created_by.email,
|
||||||
|
[item.assigned_to.email, ], fail_silently=False)
|
||||||
|
except ConnectionRefusedError:
|
||||||
|
messages.error(request, "Task saved but mail not sent. Contact your administrator.")
|
||||||
|
|
||||||
messages.success(request, "Your trouble ticket has been submitted. We'll get back to you soon.")
|
messages.success(request, "Your trouble ticket has been submitted. We'll get back to you soon.")
|
||||||
|
|
||||||
return redirect(settings.PUBLIC_SUBMIT_REDIRECT)
|
return redirect(settings.PUBLIC_SUBMIT_REDIRECT)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
form = AddExternalItemForm()
|
form = AddExternalItemForm(initial={'priority': 999})
|
||||||
|
|
||||||
return render(request, 'todo/add_task_external.html', locals())
|
return render(request, 'todo/add_task_external.html', locals())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue