Allow unassigned ("anyone") tickets

- Requires a migration
This commit is contained in:
Scot Hacker 2016-04-09 11:56:27 -07:00
parent 5e4f6e8d77
commit 9b6418c7b1
4 changed files with 28 additions and 12 deletions

View file

@ -293,9 +293,7 @@ def reorder_tasks(request):
def external_add(request):
"""
Allow users who don't have access to the rest of the ticket system to file a ticket in a specific list.
This is useful if, for example, a core web team are in a group that can file todos for each other,
but you also want students to be able to post trouble tickets to a list just for the sysadmin. This
way we don't have to put all users into a group that gives them access to the whole ticket system.
Public tickets are unassigned unless settings.DEFAULT_ASSIGNEE exists.
"""
if request.POST:
form = AddExternalItemForm(request.POST)
@ -304,7 +302,8 @@ def external_add(request):
item = form.save(commit=False)
item.list_id = settings.DEFAULT_LIST_ID
item.created_by = request.user
item.assigned_to = User.objects.get(username=settings.DEFAULT_ASSIGNEE)
if settings.DEFAULT_ASSIGNEE:
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})