Formatting

This commit is contained in:
Scot Hacker 2019-04-12 00:09:01 -07:00
parent 4a385bde6b
commit befc7ad2cd
28 changed files with 253 additions and 311 deletions

View file

@ -43,7 +43,7 @@ def external_add(request) -> HttpResponse:
task = form.save(commit=False)
task.task_list = TaskList.objects.get(slug=settings.TODO_DEFAULT_LIST_SLUG)
task.created_by = request.user
if defaults('TODO_DEFAULT_ASSIGNEE'):
if defaults("TODO_DEFAULT_ASSIGNEE"):
task.assigned_to = User.objects.get(username=settings.TODO_DEFAULT_ASSIGNEE)
task.save()

View file

@ -18,10 +18,7 @@ def remove_attachment(request, attachment_id: int) -> HttpResponse:
if request.method == "POST":
attachment = get_object_or_404(Attachment, pk=attachment_id)
redir_url = reverse(
"todo:task_detail",
kwargs={"task_id": attachment.task.id},
)
redir_url = reverse("todo:task_detail", kwargs={"task_id": attachment.task.id})
# Permissions
if not (
@ -33,7 +30,9 @@ def remove_attachment(request, attachment_id: int) -> HttpResponse:
if remove_attachment_file(attachment.id):
messages.success(request, f"Attachment {attachment.id} removed.")
else:
messages.error(request, f"Sorry, there was a problem deleting attachment {attachment.id}.")
messages.error(
request, f"Sorry, there was a problem deleting attachment {attachment.id}."
)
return redirect(redir_url)

View file

@ -121,13 +121,13 @@ def task_detail(request, task_id: int) -> HttpResponse:
if request.FILES.get("attachment_file_input"):
file = request.FILES.get("attachment_file_input")
if file.size > defaults('TODO_MAXIMUM_ATTACHMENT_SIZE'):
if file.size > defaults("TODO_MAXIMUM_ATTACHMENT_SIZE"):
messages.error(request, f"File exceeds maximum attachment size.")
return redirect("todo:task_detail", task_id=task.id)
name, extension = os.path.splitext(file.name)
if extension not in defaults('TODO_LIMIT_FILE_ATTACHMENTS'):
if extension not in defaults("TODO_LIMIT_FILE_ATTACHMENTS"):
messages.error(request, f"This site does not allow upload of {extension} files.")
return redirect("todo:task_detail", task_id=task.id)
@ -144,7 +144,7 @@ def task_detail(request, task_id: int) -> HttpResponse:
"merge_form": merge_form,
"thedate": thedate,
"comment_classes": defaults("TODO_COMMENT_CLASSES"),
"attachments_enabled": defaults('TODO_ALLOW_FILE_ATTACHMENTS'),
"attachments_enabled": defaults("TODO_ALLOW_FILE_ATTACHMENTS"),
}
return render(request, "todo/task_detail.html", context)