diff --git a/apps/wei/forms/surveys/wei2021.py b/apps/wei/forms/surveys/wei2021.py index fd788a74f2fd52529ddfb162f19b88a4c75c8e7d..16a9961cb483bd3ff22cf1255ee6f1009f5a3614 100644 --- a/apps/wei/forms/surveys/wei2021.py +++ b/apps/wei/forms/surveys/wei2021.py @@ -40,6 +40,7 @@ class WEISurveyForm2021(forms.Form): if not information.seed: information.seed = int(1000 * time.time()) information.save(registration) + registration._force_save = True registration.save() rng = Random(information.seed) diff --git a/apps/wei/views.py b/apps/wei/views.py index 231fc2201b293790c838986a5aea2abf73124df0..2fb1f4a5302b9602e0c72616e5f0340ebb535002 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -487,9 +487,13 @@ class WEIRegister1AView(ProtectQuerysetMixin, ProtectedCreateView): def get_sample_object(self): wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"]) + if "myself" in self.request.path: + user = self.request.user + else: + user = User.objects.get(username="note") return WEIRegistration( wei=wei, - user=User.objects.get(username="note"), + user=user, first_year=True, birth_date="1970-01-01", gender="No", @@ -555,9 +559,13 @@ class WEIRegister2AView(ProtectQuerysetMixin, ProtectedCreateView): def get_sample_object(self): wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"]) + if "myself" in self.request.path: + user = self.request.user + else: + user = User.objects.get(username="note") return WEIRegistration( wei=wei, - user=User.objects.get(username="note"), + user=user, first_year=True, birth_date="1970-01-01", gender="No",