From 0eed19e1b58be7edacbe9c3a5c69291c83bb44ff Mon Sep 17 00:00:00 2001 From: Edo Storm Date: Tue, 1 Oct 2024 16:58:43 +0200 Subject: [PATCH] style: back to black --- studies/views/study_views.py | 6 ++++-- tasks/views/task_views.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/studies/views/study_views.py b/studies/views/study_views.py index a30527ba7..5691018a6 100644 --- a/studies/views/study_views.py +++ b/studies/views/study_views.py @@ -106,13 +106,15 @@ def form_valid(self, form): for study_type in form.fields["study_types"].choices: form_value = study_type[0] in form.data.getlist("study_types") form.instance.__setattr__(study_type[0], form_value) - if not form.instance.has_intervention and hasattr(form.instance, "intervention"): + if not form.instance.has_intervention and hasattr( + form.instance, "intervention" + ): form.instance.intervention.delete() if not form.instance.has_observation and hasattr(form.instance, "observation"): form.instance.observation.delete() if not form.instance.has_sessions and form.instance.session_set.all(): for session in form.instance.session_set.all(): - session.delete() + session.delete() form.instance.save() return super(StudyDesign, self).form_valid(form) diff --git a/tasks/views/task_views.py b/tasks/views/task_views.py index 24158c3b9..30e2ef44a 100644 --- a/tasks/views/task_views.py +++ b/tasks/views/task_views.py @@ -65,7 +65,7 @@ def form_valid(self, form): def get_session(self): """Retrieves the Study from the pk kwarg""" return Session.objects.get(pk=self.kwargs["pk"]) - + def get_proposal(self): return self.get_session().study.proposal