Skip to content

Commit

Permalink
style: back to black
Browse files Browse the repository at this point in the history
  • Loading branch information
EdoStorm96 committed Oct 1, 2024
1 parent 7d45799 commit 0eed19e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions studies/views/study_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tasks/views/task_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0eed19e

Please sign in to comment.