On utilise get_username à la place de base_username

This commit is contained in:
Tom Hubrecht 2021-01-26 15:35:10 +01:00
parent 6a59163dea
commit a4db79353b
4 changed files with 5 additions and 6 deletions

View file

@ -102,9 +102,8 @@ class User(AbstractUser):
) )
full_name = models.CharField(_("Nom et Prénom"), max_length=150, blank=True) full_name = models.CharField(_("Nom et Prénom"), max_length=150, blank=True)
@property def get_username(self):
def base_username(self): return "__".join(self.username.split("__")[1:])
return self.username.split("__")[-1]
def can_vote(self, election): def can_vote(self, election):
# Si c'est un·e utilisateur·ice CAS, iel peut voter dans les élections # Si c'est un·e utilisateur·ice CAS, iel peut voter dans les élections

View file

@ -110,7 +110,7 @@
<tbody> <tbody>
{% for v in voters %} {% for v in voters %}
<tr> <tr>
<td>{{ v.base_username }}</td> <td>{{ v.get_username }}</td>
<td>{{ v.full_name }}</td> <td>{{ v.full_name }}</td>
<td>{{ v.email }}</td> <td>{{ v.email }}</td>
</tr> </tr>

View file

@ -103,7 +103,7 @@ def send_mail(election, mail_form):
body=mail_form.cleaned_data["message"].format( body=mail_form.cleaned_data["message"].format(
full_name=v.full_name, full_name=v.full_name,
election_url=url, election_url=url,
username=v.base_username, username=v.get_username,
password=password, password=password,
), ),
to=[v.email], to=[v.email],

View file

@ -50,7 +50,7 @@
{% if user.is_authenticated %} {% if user.is_authenticated %}
<div class="level-item mr-5"> <div class="level-item mr-5">
<div class="tag"> <div class="tag">
{% 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 %}
</div> </div>
</div> </div>