On utilise get_username à la place de base_username
This commit is contained in:
parent
6a59163dea
commit
a4db79353b
4 changed files with 5 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<tbody>
|
||||
{% for v in voters %}
|
||||
<tr>
|
||||
<td>{{ v.base_username }}</td>
|
||||
<td>{{ v.get_username }}</td>
|
||||
<td>{{ v.full_name }}</td>
|
||||
<td>{{ v.email }}</td>
|
||||
</tr>
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
{% if user.is_authenticated %}
|
||||
<div class="level-item mr-5">
|
||||
<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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue