mirror of https://gitlab.crans.org/bde/nk20
Fix WEI registration in dev mode
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
6d2b7054e2
commit
ffaa020310
|
@ -490,7 +490,10 @@ class WEIRegister1AView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||
if "myself" in self.request.path:
|
||||
user = self.request.user
|
||||
else:
|
||||
user = User.objects.get(username="note")
|
||||
# To avoid unique validation issues, we use an account that can't join the WEI.
|
||||
# In development mode, the note account may not exist, we use a random user (may fail)
|
||||
user = User.objects.get(username="note") if User.objects.filter(username="note").exists() \
|
||||
else User.objects.first()
|
||||
return WEIRegistration(
|
||||
wei=wei,
|
||||
user=user,
|
||||
|
@ -562,7 +565,10 @@ class WEIRegister2AView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||
if "myself" in self.request.path:
|
||||
user = self.request.user
|
||||
else:
|
||||
user = User.objects.get(username="note")
|
||||
# To avoid unique validation issues, we use an account that can't join the WEI.
|
||||
# In development mode, the note account may not exist, we use a random user (may fail)
|
||||
user = User.objects.get(username="note") if User.objects.filter(username="note").exists() \
|
||||
else User.objects.first()
|
||||
return WEIRegistration(
|
||||
wei=wei,
|
||||
user=user,
|
||||
|
|
Loading…
Reference in New Issue