diff --git a/todo/forms.py b/todo/forms.py
index 6a970c1..d4a4d54 100644
--- a/todo/forms.py
+++ b/todo/forms.py
@@ -63,16 +63,21 @@ class AddExternalItemForm(ModelForm):
"""Form to allow users who are not part of the GTD system to file a ticket."""
title = forms.CharField(
- widget=forms.widgets.TextInput(attrs={'size': 35})
+ widget=forms.widgets.TextInput(attrs={'size': 35}),
+ label="Summary"
)
note = forms.CharField(
widget=forms.widgets.Textarea(),
- help_text='Please describe the issue.',
+ label='Problem Description',
+ )
+ priority = forms.IntegerField(
+ widget=forms.HiddenInput(),
)
class Meta:
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):
diff --git a/todo/templates/todo/add_task_external.html b/todo/templates/todo/add_task_external.html
index 9bfb365..bf0a0a7 100644
--- a/todo/templates/todo/add_task_external.html
+++ b/todo/templates/todo/add_task_external.html
@@ -4,56 +4,61 @@
{% block content %}
-
{{ task }}
+ {{ task }}
-
-{% endblock %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/todo/views.py b/todo/views.py
index 85071fd..e890c00 100644
--- a/todo/views.py
+++ b/todo/views.py
@@ -315,19 +315,22 @@ def external_add(request):
item.assigned_to = User.objects.get(username=settings.DEFAULT_ASSIGNEE)
item.save()
- email_subject = render_to_string("todo/email/assigned_subject.txt", {'task': item.title})
- email_body = render_to_string("todo/email/assigned_body.txt", {'task': item, 'site': current_site, })
- try:
- send_mail(
- 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.")
+ # Send email to assignee if we have one
+ if item.assigned_to:
+ email_subject = render_to_string("todo/email/assigned_subject.txt", {'task': item.title})
+ email_body = render_to_string("todo/email/assigned_body.txt", {'task': item, 'site': current_site, })
+ try:
+ send_mail(
+ 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.")
return redirect(settings.PUBLIC_SUBMIT_REDIRECT)
else:
- form = AddExternalItemForm()
+ form = AddExternalItemForm(initial={'priority': 999})
return render(request, 'todo/add_task_external.html', locals())