From 2821848f29cdfdf277dbcbd760bfb6e110dfa4d1 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Thu, 28 Jan 2021 00:29:20 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9but=20pour=20la=20traduction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- annuaire/settings.py | 1 + fiches/static/fiches/css/annuaire.css | 7 + fiches/static/fiches/scss/_common.scss | 2 +- fiches/static/fiches/scss/_header.scss | 7 +- fiches/static/fiches/scss/annuaire.scss | 2 +- fiches/templates/fiches/base.html | 9 +- fiches/templates/fiches/base.html.py | 83 ++++++++++++ fiches/templates/fiches/birthday.html.py | 23 ++++ fiches/templates/fiches/fiche.html.py | 107 +++++++++++++++ fiches/templates/fiches/fiches_modif.html.py | 124 ++++++++++++++++++ fiches/templates/fiches/home.html.py | 34 +++++ .../templates/fiches/mail/mail_modif.txt.py | 6 + fiches/templates/fiches/multientry.html.py | 25 ++++ fiches/views.py | 86 +++++++----- 14 files changed, 480 insertions(+), 36 deletions(-) create mode 100644 fiches/templates/fiches/base.html.py create mode 100644 fiches/templates/fiches/birthday.html.py create mode 100644 fiches/templates/fiches/fiche.html.py create mode 100644 fiches/templates/fiches/fiches_modif.html.py create mode 100644 fiches/templates/fiches/home.html.py create mode 100644 fiches/templates/fiches/mail/mail_modif.txt.py create mode 100644 fiches/templates/fiches/multientry.html.py diff --git a/annuaire/settings.py b/annuaire/settings.py index 4a86b9a..ee51242 100644 --- a/annuaire/settings.py +++ b/annuaire/settings.py @@ -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", diff --git a/fiches/static/fiches/css/annuaire.css b/fiches/static/fiches/css/annuaire.css index d6f4784..93b80ac 100644 --- a/fiches/static/fiches/css/annuaire.css +++ b/fiches/static/fiches/css/annuaire.css @@ -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 */ diff --git a/fiches/static/fiches/scss/_common.scss b/fiches/static/fiches/scss/_common.scss index 6f97d97..30bb280 100644 --- a/fiches/static/fiches/scss/_common.scss +++ b/fiches/static/fiches/scss/_common.scss @@ -46,7 +46,7 @@ body { #header { margin: 0; } - + #main { margin: 0; } diff --git a/fiches/static/fiches/scss/_header.scss b/fiches/static/fiches/scss/_header.scss index d9d90ad..d701a21 100644 --- a/fiches/static/fiches/scss/_header.scss +++ b/fiches/static/fiches/scss/_header.scss @@ -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, @@ -161,4 +166,4 @@ $account-area-height: 120px; .clipper { font-family: fonts.$monospace-fonts; } -} \ No newline at end of file +} diff --git a/fiches/static/fiches/scss/annuaire.scss b/fiches/static/fiches/scss/annuaire.scss index d9217eb..09cfe85 100644 --- a/fiches/static/fiches/scss/annuaire.scss +++ b/fiches/static/fiches/scss/annuaire.scss @@ -1,4 +1,4 @@ @use "common"; @use "header"; @use "content"; -@use "footer"; \ No newline at end of file +@use "footer"; diff --git a/fiches/templates/fiches/base.html b/fiches/templates/fiches/base.html index 3c8234c..9ecc5f6 100644 --- a/fiches/templates/fiches/base.html +++ b/fiches/templates/fiches/base.html @@ -17,8 +17,12 @@
{% block extra_js %}{% endblock %} + diff --git a/fiches/templates/fiches/base.html.py b/fiches/templates/fiches/base.html.py new file mode 100644 index 0000000..74bdc05 --- /dev/null +++ b/fiches/templates/fiches/base.html.py @@ -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 %(user)s') 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 · 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 diff --git a/fiches/templates/fiches/birthday.html.py b/fiches/templates/fiches/birthday.html.py new file mode 100644 index 0000000..7f0cf09 --- /dev/null +++ b/fiches/templates/fiches/birthday.html.py @@ -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 diff --git a/fiches/templates/fiches/fiche.html.py b/fiches/templates/fiches/fiche.html.py new file mode 100644 index 0000000..f5cef6f --- /dev/null +++ b/fiches/templates/fiches/fiche.html.py @@ -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 diff --git a/fiches/templates/fiches/fiches_modif.html.py b/fiches/templates/fiches/fiches_modif.html.py new file mode 100644 index 0000000..14e9393 --- /dev/null +++ b/fiches/templates/fiches/fiches_modif.html.py @@ -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 diff --git a/fiches/templates/fiches/home.html.py b/fiches/templates/fiches/home.html.py new file mode 100644 index 0000000..4afa361 --- /dev/null +++ b/fiches/templates/fiches/home.html.py @@ -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 diff --git a/fiches/templates/fiches/mail/mail_modif.txt.py b/fiches/templates/fiches/mail/mail_modif.txt.py new file mode 100644 index 0000000..3bc75d3 --- /dev/null +++ b/fiches/templates/fiches/mail/mail_modif.txt.py @@ -0,0 +1,6 @@ +XXXXXXX X + +XX XXXXX XXXXXXXX X XXX XXXXXXXX X + +XXXXXXXXXXXXX +XX XXXX XXX \ No newline at end of file diff --git a/fiches/templates/fiches/multientry.html.py b/fiches/templates/fiches/multientry.html.py new file mode 100644 index 0000000..c6ff1b6 --- /dev/null +++ b/fiches/templates/fiches/multientry.html.py @@ -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 \ No newline at end of file diff --git a/fiches/views.py b/fiches/views.py index c7da8f5..db8ea5b 100644 --- a/fiches/views.py +++ b/fiches/views.py @@ -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, - phone_form=phone_form, - social_form=social_form, - mail_form=mail_form, - address_form=address_form)) + self.get_context_data( + form=form, + phone_form=phone_form, + social_form=social_form, + mail_form=mail_form, + address_form=address_form, + ) + ) def post(self, request, *args, **kwargs): self.object = self.get_object() @@ -56,12 +66,21 @@ 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() phone_form.save() @@ -69,21 +88,26 @@ class EditView(UpdateView): mail_form.save() address_form.save() send_mail( - "Fiche annuaire modifée", - 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, - ) + "Fiche annuaire modifée", + 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, + ) return HttpResponseRedirect(self.get_success_url()) def form_invalid(self, form, phone_form, social_form, mail_form, address_form): return self.render_to_response( - self.get_context_data(form=form, - phone_form=phone_form, - social_form=social_form, - mail_form=mail_form, - address_form=address_form)) + self.get_context_data( + form=form, + phone_form=phone_form, + social_form=social_form, + mail_form=mail_form, + address_form=address_form, + ) + ) def get_object(self): return self.request.user.profile @@ -100,9 +124,9 @@ class HomeView(FormView): def form_valid(self, form): result = Profile.objects.filter( - Q(full_name__icontains=form.cleaned_data["name"]) - | Q(nickname__icontains=form.cleaned_data["name"]) - ) + Q(full_name__icontains=form.cleaned_data["name"]) + | Q(nickname__icontains=form.cleaned_data["name"]) + ) return self.render_to_response(self.get_context_data(result=result)) @@ -111,19 +135,19 @@ 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 ) ) - return context \ No newline at end of file + return context