mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
[WEI] Fix permission check to register new accounts to users
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
5bf6a5501d
commit
a2a749e1ca
@ -44,16 +44,17 @@ class WEISurveyForm2021(forms.Form):
|
|||||||
|
|
||||||
rng = Random(information.seed)
|
rng = Random(information.seed)
|
||||||
|
|
||||||
words = []
|
words = None
|
||||||
for _ignored in range(information.step + 1):
|
# Update seed
|
||||||
# Generate N times words
|
rng.randint(0, information.step)
|
||||||
words = None
|
|
||||||
preferred_words = {bus: [word for word in WORDS if WEIBusInformation2021(bus).scores[word] >= 50]
|
preferred_words = {bus: [word for word in WORDS if bus.size > 0
|
||||||
for bus in WEISurveyAlgorithm2021.get_buses()}
|
and WEIBusInformation2021(bus).scores[word] >= 50]
|
||||||
while words is None or len(set(words)) != len(words):
|
for bus in WEISurveyAlgorithm2021.get_buses()}
|
||||||
# Ensure that there is no the same word 2 times
|
while words is None or len(set(words)) != len(words):
|
||||||
words = [rng.choice(words) for _ignored2, words in preferred_words.items()]
|
# Ensure that there is no the same word 2 times
|
||||||
rng.shuffle(words)
|
words = [rng.choice(words) for _ignored2, words in preferred_words.items()]
|
||||||
|
rng.shuffle(words)
|
||||||
words = [(w, w) for w in words]
|
words = [(w, w) for w in words]
|
||||||
if self.data:
|
if self.data:
|
||||||
self.fields["word"].choices = [(w, w) for w in WORDS]
|
self.fields["word"].choices = [(w, w) for w in WORDS]
|
||||||
|
@ -489,7 +489,7 @@ class WEIRegister1AView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||||||
wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"])
|
wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"])
|
||||||
return WEIRegistration(
|
return WEIRegistration(
|
||||||
wei=wei,
|
wei=wei,
|
||||||
user=self.request.user,
|
user=User.objects.get(username="note"),
|
||||||
first_year=True,
|
first_year=True,
|
||||||
birth_date="1970-01-01",
|
birth_date="1970-01-01",
|
||||||
gender="No",
|
gender="No",
|
||||||
@ -557,7 +557,7 @@ class WEIRegister2AView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||||||
wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"])
|
wei = WEIClub.objects.get(pk=self.kwargs["wei_pk"])
|
||||||
return WEIRegistration(
|
return WEIRegistration(
|
||||||
wei=wei,
|
wei=wei,
|
||||||
user=self.request.user,
|
user=User.objects.get(username="note"),
|
||||||
first_year=True,
|
first_year=True,
|
||||||
birth_date="1970-01-01",
|
birth_date="1970-01-01",
|
||||||
gender="No",
|
gender="No",
|
||||||
|
Loading…
Reference in New Issue
Block a user