@staff_member_required
def delete_task(request, task_id):
    try:
        task = Task.objects.get(pk=task_id)
    except Task.DoesNotExist:
        return Http404('Task not found')
    if (request.method == 'POST'):
        if (request.POST['choice'] == 'Yes'):
            task.delete()
            messages.success(request, (('The task ' + task.name) + ' was deleted.'))
        return redirect('index')
    else:
        return render(request, 'annotationweb/delete_task.html', {'task': task})
@staff_member_required
def delete_task(request, task_id):
    try:
        task = Task.objects.get(pk=task_id)
    except Task.DoesNotExist:
        return Http404('Task not found')
    if (request.method == 'POST'):
        if (request.POST['choice'] == 'Yes'):
            task.delete()
            messages.success(request, (('The task ' + task.name) + ' was deleted.'))
        return redirect('index')
    else:
        return render(request, 'annotationweb/delete_task.html', {'task': task})