From 3330b4b598e4f004341e1ec2901a240aa5820ffd Mon Sep 17 00:00:00 2001 From: luto Date: Sat, 2 Nov 2024 18:44:56 +0100 Subject: [PATCH] formatting --- src/crowdprinter/views.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/crowdprinter/views.py b/src/crowdprinter/views.py index eed6b21..6952441 100644 --- a/src/crowdprinter/views.py +++ b/src/crowdprinter/views.py @@ -87,7 +87,10 @@ def get_context_data(self, object): def take_print_job(request, slug): job = get_object_or_404(models.PrintJob, slug=slug) if request.method == "POST" and can_take_job(request.user, job): - models.PrintAttempt.objects.create(job=job, user=request.user) + models.PrintAttempt.objects.create( + job=job, + user=request.user, + ) return HttpResponseRedirect(reverse("printjob_detail", kwargs={"slug": slug})) @@ -96,7 +99,10 @@ def take_print_job(request, slug): def give_back_print_job(request, slug): if request.method == "POST": attempt = get_object_or_404( - models.PrintAttempt, job__slug=slug, user=request.user, ended__isnull=True + models.PrintAttempt, + job__slug=slug, + user=request.user, + ended__isnull=True, ) attempt.ended = datetime.date.today() attempt.save() @@ -108,7 +114,10 @@ def give_back_print_job(request, slug): def printjob_done(request, slug): if request.method == "POST": attempt = get_object_or_404( - models.PrintAttempt, job__slug=slug, user=request.user, ended__isnull=True + models.PrintAttempt, + job__slug=slug, + user=request.user, + ended__isnull=True, ) attempt.ended = datetime.date.today() attempt.finished = True @@ -136,7 +145,10 @@ def get_file_path(self, **kwargs): class ServeStlView(ServeFileView): def get_file_path(self, **kwargs): - printjob = get_object_or_404(models.PrintJob, slug=kwargs["slug"]) + printjob = get_object_or_404( + models.PrintJob, + slug=kwargs["slug"], + ) if self.request.user not in printjob.attempting_users: raise Http404() return printjob.file_stl.path @@ -147,7 +159,10 @@ class ServeRenderView(ServeFileView): as_attachment = False def get_file_path(self, **kwargs): - printjob = get_object_or_404(models.PrintJob, slug=kwargs["slug"]) + printjob = get_object_or_404( + models.PrintJob, + slug=kwargs["slug"], + ) return printjob.file_render.path