mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 03:18:27 +02:00
Sidebar structure
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -12,6 +12,7 @@ from django.utils import timezone
|
||||
from django.utils.crypto import get_random_string
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.utils.http import urlsafe_base64_encode
|
||||
from django.utils.text import format_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from phonenumber_field.modelfields import PhoneNumberField
|
||||
from polymorphic.models import PolymorphicModel
|
||||
@ -88,6 +89,28 @@ class Registration(PolymorphicModel):
|
||||
def get_absolute_url(self):
|
||||
return reverse_lazy("registration:user_detail", args=(self.user_id,))
|
||||
|
||||
def registration_informations(self):
|
||||
return []
|
||||
|
||||
def important_informations(self):
|
||||
informations = []
|
||||
if not self.email_confirmed:
|
||||
text = _("Your email address is not validated. Please click on the link you received by email. "
|
||||
"You can resend a mail by clicking on <a href=\"{send_email_url}\">this link</a>.")
|
||||
send_email_url = reverse_lazy("registration:email_validation_resend", args=(self.user_id,))
|
||||
content = format_lazy(text, send_email_url=send_email_url)
|
||||
informations.append({
|
||||
'title': "Validation e-mail",
|
||||
'type': "warning",
|
||||
'priority': 0,
|
||||
'content': content,
|
||||
})
|
||||
|
||||
informations.extend(self.registration_informations())
|
||||
|
||||
informations.sort(key=lambda info: (info['priority'], info['title']))
|
||||
return informations
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.user.first_name} {self.user.last_name}"
|
||||
|
||||
|
Reference in New Issue
Block a user