Début pour la traduction

This commit is contained in:
Tom Hubrecht 2021-01-28 00:29:20 +01:00
parent d61fdd912d
commit 2821848f29
14 changed files with 480 additions and 36 deletions

View file

@ -63,6 +63,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",

View file

@ -147,11 +147,16 @@ body {
text-align: center;
}
#language_switch .language {
margin: 0;
padding: 0;
display: inline-block;
background: none;
border: none;
color: #DFDFDF;
}
#language_switch .language:hover {
color: #FFDC00;
cursor: pointer;
}
#language_switch .language::after,
#language_switch .current-language::after {
@ -523,3 +528,5 @@ body {
display: block;
text-align: center;
}
/*# sourceMappingURL=annuaire.css.map */

View file

@ -81,13 +81,18 @@ $account-area-height: 120px;
text-align: center;
.language {
margin: 0;
padding: 0;
display: inline-block;
background: none;
border: none;
// text-decoration: underline;
color: colors.$page-text-secondary;
}
.language:hover {
color: colors.$main-menu-link;
cursor: pointer;
}
.language::after,

View file

@ -17,8 +17,12 @@
<div id="aside">
<div id="menu">
<div id="language_switch">
<a class="language french {% if get_current_language == "fr" %}current-language{% endif %}" href="/fr{{ request.get_full_path|slice:'3:' }}">Français</a>
<a class="language english {% if get_current_language == "en" %}current-language{% endif %}" href="/en{{ request.get_full_path|slice:'3:' }}">English</a>
<form action="{% url 'set_language' %}" method="post">
{% csrf_token %}
{% get_current_language as lang %}
<input name="next" type="hidden" value="{{ request.get_full_path }}">
<button class="language {% if lang == "fr" %}current-language{% endif %}" name="language" value="fr">Français</button><button class="language {% if lang == "en" %}current-language{% endif %}" name="language" value="en">English</button>
</form>
</div>
<form id="search-area" method="post" action='{% url "home" %}'>
@ -75,4 +79,5 @@
</div>
</body>
{% block extra_js %}{% endblock %}
</html>

View file

@ -0,0 +1,83 @@
BBBB BBBB
BBBB BBBBBBBBBBB
XXXXXXXXX XXXXX
XXXXXX
XXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXX
XXXXXXX
BBBBB BBBBBBBBBBBB gettext(u"Annuaire des élèves de l'ENS") BBBBBBBB
XXXXXXXX
XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBBX XX
XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBX XX
XXXXXXX
XXXXXX
XXXX XXXXXXXXXXX
XXXX XXXXXXXXXX
XXXX XXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXBBB BBBBBBBBBBBBBBX XXXXXXXXXXXXXX
BBBBBBBBBB
BBBBBBBBBBBBBBBBBBBB BB BBBB
XXXXXX XXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXX
XXXXXXX XXXXXXXXXXXXXXX BB BBBB BB BBBBBBBXXXXXXXXXXXXXXXXBBBBBX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX BB BBBB BB BBBBXXXXXXXXXXXXXXXXBBBBBX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXX
XXXXXX
XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXBBB BBBBBBXX
BBBBBBBBBB
XXXXXX XXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXX
XXXXXXX XXXXXXXXXXXXXX gettext(u'Rechercher') XXXXXXXXX
XXXXXXX
XXX XXXXXXXXXXX
BBBBB BBBBB XX XXXXXXBBB BBBBBBXX gettext(u"Annuaire des élèves de l'ENS") XXXXBBBBBBBB
XXXXX
XXXX XXXXXXXXXXXXXXX
XXXXX
XX XXXXXXBBB BBBBBBXX gettext(u'Accueil') XXXX
XX XXXXXXBBB BBBBBBBBBBBBBXX gettext(u"Modifier sa fiche d'annuaire") XXXX
BB BBBBBBBBBBBBBBBBBBBBB
XX XXXXXXBBB BBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBXX gettext(u"Consulter sa fiche d'annuaire") XXXX
BBBBB
XX XXXXXXBBB BBBBBBBBBBXX gettext(u'Anniversaires à venir') XXXX
XXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXXX
BB BBBBBBBBBBBBBBBBBBBBB
gettext(u'Connecté en tant que <span class="clipper">%(user)s</span>') SSSSSSSS SS SSSS SSS SSSSS SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSXXX XX
XX XXXXXXBBB BBBBBBBBBBBBBBBXX gettext(u'Se déconnecter') XXXX
BBBB
XX XXXXXXBBB BBBBBBBBBBBBBBXX gettext(u'Se connecter') XXXX
BBBBB
XXXXXX
XXXXXX
XXXXXX
XXXX XXXXXXXXXX
XXXX XXXXXXXXXXXXXXXXXX
BBBBB BBBBBBBBBBBBBBBBBBBBB
BBBBB BBBBBBBBBBBBBBB
XXXXXX
XXXX XXXXXXXXXXXX
BBBBB BBBBBB
XXXXX XXXXXXXXXXXXXXX
gettext(u'Crée par KDENS &middot; Propulsé par Django')
XXXXXXX
XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u'Page des élèves') XXXXX
XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX gettext(u"Contacter l'équipe annuaire") XXXXX
BBBBBBBB
XXXXXX
XXXXXX
XXXXXXX
BBBBB BBBBBBBBBBBBBBBB
XXXXXXX

View file

@ -0,0 +1,23 @@
BBBBBBB BBBBBBBBBBBBBBBBBB
BBBB BBBB
BBBBB BBBBBBB
XXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
XXXX gettext(u'Anniversaires') XXXXX
XXXXX
XXXX
BBB BBBBBBB BB BBBBBB
XXXX
XX XXXXXXBBB BBBBBBB BBBBBBBBBBBBBBBBBBBBBXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX X FFFFFFF FF
XXXXX XXXXXXXXXXXXX gettext(u'ans') XXXXXXXX
XXXXX
BBBBBB
XXXXX
XXXXXX
XXXXXX
BBBBBBBB

View file

@ -0,0 +1,107 @@
BBBBBBB BBBBBBBBBBBBBBBBBB
BBBB BBBB
BBBBB BBBBBBB
XXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXXXXXXXXXXXXXXXXXXX
BB BBBBBBBBBBBBBBB
XX XXXXXXXX
XXXX XXXXXXXXXXXXX XXXXXXX
XXXX
BBBBB
XXX XXXXXXXXXXXXX
XX
BB BBBBBBBBBBBBBBBB
XXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXXX
BBBBB
XXXXX
XXXXXX
XXXX XXXXXXXXXXXXXX
BB BBBBBBBBBBBBBBB
XXXX XXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXX gettext(u'Pronom(s) utilisé(s)') XXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXX
XXXXXX
BBBBB
BB BBBBBBBBBBBBBBBBBBBBBBBBB
XXXX XXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXX gettext(u'Département') FFFFFFFFFXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXBBB BBB BB BBBBBBBBBBBBBBBBBBBBBBBB BBB BBBBBBBBBBBBX BBBBBBBBBBBXXXXXXX
XXXXXX
BBBBB
BB BBBBBBBBBBBBBBBBBB
XXXX XXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXX gettext(u'Date de naissance') XXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXX
XXXXXX
BBBBB
BB BBBBBBBBBBBBBB
XXXX XXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXX gettext(u'Thurne') XXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXX
XXXXXX
BBBBB
BB BBBBBBBBBBBBBBBBBBBBBBBB
XXXX XXXXXXXXXXXX XXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXX gettext(u'Téléphone') FFFFFFFFFXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXX
BBB B BB BBBBBBBBBBBBBBBBBBBBB
XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
BBBBBB
XXXXX
XXXXXX
BBBBB
BB BBBBBBBBBBBBBBBBBBBBBBBBB
XXXX XXXXXXXXXXXXX XXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXX _("Réseau social,Réseaux sociaux") XXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXX
BBB B BB BBBBBBBBBBBBBBBBBBBBBB
XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
BBBBBB
XXXXX
XXXXXX
BBBBB
BB BBBBBBBBBBBBBBBBBBBBBBB
XXXX XXXXXXXXXXX XXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXX _("Mail,Mails") XXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXX
BBB B BB BBBBBBBBBBBBBBBBBBBB
XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
BBBBBB
XXXXX
XXXXXX
BBBBB
BB BBBBBBBBBBBBBBBBBBBBBBBBBB
XXXX XXXXXXXXXXXXXX XXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXX _("Adresse,Adresses") XXXXXXX
XXXXX XXXXXXXXXXXXXXXXXXXXXXXXX
XXX XXXXXXXXXXXXXX
BBB B BB BBBBBBBBBBBBBBBBBBBBBBB
XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
BBBBBB
XXXXX
XXXXXX
BBBBB
XXXXXX
BB BBBBBBBBBBBBBBBBBB
XXXX XXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXX gettext(u'Champ libre') XXXXXXX
XX XXXXXXXXXXXXXXXXXX
XXXXXX
BBBBB
XXXXXX
BBBBBBBB

View file

@ -0,0 +1,124 @@
BBBBBBB BBBBBBBBBBBBBBBBBB
BBBB BBBB
BBBB BBBBBBBBBBB
BBBBB BBBBBBB
XXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
XXXX gettext(u"Modifier ma page d'annuaire") XXXXX
XXXXX XXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
BBBBBBBBBB
XXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXXX gettext(u'Nom :') XXXXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXX gettext(u'Surnom :') XXXXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXX gettext(u'Pronom(s) utilisé(s) :') XXXXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXX gettext(u'Photo :') XXXXXXXX
XXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX
XXXX XXXXXXXXXXXXXXXXXXXXXX
BB BBBBBBBBBBBBBBBBBBBBB
XX XXXXXXXX
XXXX XXXXXXX
XXXX
BBBB
XXXXX
BBBBB
XXXXXX
XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX
BB BBBBBBBBBBBBBBBBBBBBB
XXXX XXXXXXXXXXXXXX XXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXXXXXXX gettext(u'Effacer (cochez la case) :') XXXXXXXX
XXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
XXXXXX
BBBBB
XXXX XXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXX gettext(u'Nouvelle photo :') XXXXXXXX
XXXXXX XXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
XXXXXX
XXXXXX
XXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXXXX gettext(u'Département :') XXXXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXXX gettext(u'Promotion :') XXXXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXXXX gettext(u'Date de naissance :') XXXXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXX gettext(u'Thurne :') XXXXXXXX
XXXXXX
XXXX
XXXXXXXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXX gettext(u'Personnel') X
XXXXXXXXXXXXXXXXXXXXXXXX gettext(u'0612345678') X
X
XXXXXX XXXXXXXXXXXXXXX gettext(u'Numéro(s) de téléphone :') XXXXXXXX
gettext(u'Ajouter un numéro')
BBBBBBB BBBBBBBBBBBBBBBBBBBBBBBB BBBB BBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBB
XXXXXX
XXXX
XXXXXXXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXX gettext(u'InstaTok') X
XXXXXXXXXXXXXXXXXXXXXXXX gettext(u'mon_profil_instatok') X
X
XXXXXX XXXXXXXXXXXXXXXX gettext(u'Réseaux sociaux :') XXXXXXXX
gettext(u'Ajouter un réseau social')
BBBBBBB BBBBBBBBBBBBBBBBBBBBBBBB BBBB BBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBB
XXXXXX
XXXX
XXXXXXXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXX gettext(u'Professionelle') X
XXXXXXXXXXXXXXXXXXXXXXXX gettext(u'moi@ens.fr') X
X
XXXXXX XXXXXXXXXXXXXX gettext(u'Mail(s):') XXXXXXXX
gettext(u'Ajouter un email')
BBBBBBB BBBBBBBBBBBBBBBBBBBBBBBB BBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBBBBB
XXXXXX
XXXX
XXXXXXXXXXXXXXXXX XXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXX gettext(u'Bureau') X
XXXXXXXXXXXXXXXXXXXXXXXX gettext(u"45 rue d'Ulm") X
X
XXXXXX XXXXXXXXXXXXXXXXX gettext(u'Adresse(s):') XXXXXXXX
gettext(u'Ajouter une adresse')
BBBBBBB BBBBBBBBBBBBBBBBBBBBBBBB BBBB BBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBB
XXXXXX
XXXX XXXXXXXXXXXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXXXX gettext(u'Champ libre :') XXXXXXXX
XXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXX XXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXX gettext(u"Apparaître sur l'annuaire papier ?") XXXXXXXX
XXXXXX
XXXX XXXXXXXXXXXXXXXXX XXXXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXX gettext(u'Conserver la fiche annuaire ?') XXXXXXXX
XXXXXX
XXXXXX XXXXXXXXXXXXX XXXXXXX gettext(u'Enregistrer') XX
XXXXXXX
XXXXXX
BBBBBBBB
BBBBB BBBBBBBB
XXXXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXBBBBBB BBBBBBBBBBBBBBBBBBBBXXXXXXXXXXX
BBBBBBBB

View file

@ -0,0 +1,34 @@
BBBBBBB BBBBBBBBBBBBBBBBBB
BBBB BBBB
BBBBB BBBBBBB
XXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX
XXXX gettext(u"Chercher quelqu'un·e dans l'annuaire") XXXXX
XXXXX XXXXXXXXXXXXX XXXXXXXXXX
BBBBBBBBBB
XXXXXX XXXXXXXXXXXXXX gettext(u'Nom/Surnom :') XXXXXXXX
XXXXXX XXXXXXXXXXXXXX gettext(u'Promotion :') XXXXXXXX
XXXXXX XXXXXXXXXXXXXXXXXXXX gettext(u'Department :') XXXXXXXX
XXXXXX XXXXXXXXXXXXX XXXXXXX gettext(u'Recherche') XX
XXXXXXX
XXXXX
XXXX
BBB BBBBBBB BB BBBBBB
XXXX
XX XXXXXXBBB BBBBBBB BBBBBBBBBBBBBBBBBBBBBXX XFFFFFFF F XXXXX
XXXXX
BBBBBB
XXXXX
XXXXXX
XXXXXX
BBBBBBBB

View file

@ -0,0 +1,6 @@
XXXXXXX X
XX XXXXX XXXXXXXX X XXX XXXXXXXX X
XXXXXXXXXXXXX
XX XXXX XXX

View file

@ -0,0 +1,25 @@
BBB BBBB BB BBBBBBB
XXXX XXXXXXXXXXXXXXXXXXXXX BB BBBBBBBBBBBXXXXXXXXXBBBBBXX
BBB BBBBB BB BBBBBBBBBBBBBBBBBBB
BBBBBB
BBB BBBBB BB BBBBBBBBBBBBBBBBBB
BBBBBB
XXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX
BBBBBB
XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
BBB BBBBB BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBB
BBB BBBBB BB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBB
XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX
XXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

View file

@ -2,7 +2,14 @@ from django.shortcuts import render
from django.shortcuts import get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from fiches.models import Profile, Phone, Social, Mail, Address
from fiches.forms import ProfileForm, SearchForm, PhoneFormSet, SocialFormSet, MailFormSet, AddressFormSet
from fiches.forms import (
ProfileForm,
SearchForm,
PhoneFormSet,
SocialFormSet,
MailFormSet,
AddressFormSet,
)
from django.forms import formset_factory
from django.forms.models import model_to_dict
from django.urls import reverse
@ -42,11 +49,14 @@ class EditView(UpdateView):
mail_form = MailFormSet(instance=self.object)
address_form = AddressFormSet(instance=self.object)
return self.render_to_response(
self.get_context_data(form=form,
self.get_context_data(
form=form,
phone_form=phone_form,
social_form=social_form,
mail_form=mail_form,
address_form=address_form))
address_form=address_form,
)
)
def post(self, request, *args, **kwargs):
self.object = self.get_object()
@ -56,11 +66,20 @@ class EditView(UpdateView):
social_form = SocialFormSet(self.request.POST, instance=self.object)
mail_form = MailFormSet(self.request.POST, instance=self.object)
address_form = AddressFormSet(self.request.POST, instance=self.object)
if (form.is_valid() and phone_form.is_valid() and social_form.is_valid()
and mail_form.is_valid() and address_form.is_valid()):
return self.form_valid(form, phone_form, social_form, mail_form, address_form)
if (
form.is_valid()
and phone_form.is_valid()
and social_form.is_valid()
and mail_form.is_valid()
and address_form.is_valid()
):
return self.form_valid(
form, phone_form, social_form, mail_form, address_form
)
else:
return self.form_invalid(form, phone_form, social_form, mail_form, address_form)
return self.form_invalid(
form, phone_form, social_form, mail_form, address_form
)
def form_valid(self, form, phone_form, social_form, mail_form, address_form):
self.object = form.save()
@ -70,7 +89,9 @@ class EditView(UpdateView):
address_form.save()
send_mail(
"Fiche annuaire modifée",
render_to_string("fiches/mail/mail_modif.txt", {"profile": self.get_object()}),
render_to_string(
"fiches/mail/mail_modif.txt", {"profile": self.get_object()}
),
"klub-dev@ens.psl.eu",
["{}@clipper.ens.psl.eu".format(self.get_object().user.username)],
fail_silently=False,
@ -79,11 +100,14 @@ class EditView(UpdateView):
def form_invalid(self, form, phone_form, social_form, mail_form, address_form):
return self.render_to_response(
self.get_context_data(form=form,
self.get_context_data(
form=form,
phone_form=phone_form,
social_form=social_form,
mail_form=mail_form,
address_form=address_form))
address_form=address_form,
)
)
def get_object(self):
return self.request.user.profile
@ -111,17 +135,17 @@ class BirthdayView(ListView):
model = Profile
template_name = "fiches/birthday.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
today = timezone.now()
context['result'] = list(
Profile.objects.filter(birth_date__day=today.day, birth_date__month=today.month)
context["result"] = list(
Profile.objects.filter(
birth_date__day=today.day, birth_date__month=today.month
)
)
for i in range(1, 7):
today = today + timedelta(days=1)
context['result'] += list(
context["result"] += list(
Profile.objects.filter(
birth_date__day=today.day, birth_date__month=today.month
)