diff --git a/elections/models.py b/elections/models.py
index 849cb7f..7b22daf 100644
--- a/elections/models.py
+++ b/elections/models.py
@@ -102,9 +102,8 @@ class User(AbstractUser):
)
full_name = models.CharField(_("Nom et Prénom"), max_length=150, blank=True)
- @property
- def base_username(self):
- return self.username.split("__")[-1]
+ def get_username(self):
+ return "__".join(self.username.split("__")[1:])
def can_vote(self, election):
# Si c'est un·e utilisateur·ice CAS, iel peut voter dans les élections
diff --git a/elections/templates/elections/upload_voters.html b/elections/templates/elections/upload_voters.html
index d7873c5..ae7a12d 100644
--- a/elections/templates/elections/upload_voters.html
+++ b/elections/templates/elections/upload_voters.html
@@ -110,7 +110,7 @@
{% for v in voters %}
- {{ v.base_username }} |
+ {{ v.get_username }} |
{{ v.full_name }} |
{{ v.email }} |
diff --git a/elections/utils.py b/elections/utils.py
index 8c59921..9beda7d 100644
--- a/elections/utils.py
+++ b/elections/utils.py
@@ -103,7 +103,7 @@ def send_mail(election, mail_form):
body=mail_form.cleaned_data["message"].format(
full_name=v.full_name,
election_url=url,
- username=v.base_username,
+ username=v.get_username,
password=password,
),
to=[v.email],
diff --git a/shared/templates/base.html b/shared/templates/base.html
index b32c4ea..dc74653 100644
--- a/shared/templates/base.html
+++ b/shared/templates/base.html
@@ -50,7 +50,7 @@
{% if user.is_authenticated %}
- {% blocktrans with name=user.base_username connection=user.connection_method %}Connecté·e en tant que {{ name }} par {{ connection }}{% endblocktrans %}
+ {% blocktrans with name=user.get_username connection=user.connection_method %}Connecté·e en tant que {{ name }} par {{ connection }}{% endblocktrans %}