diff --git a/fiches/models.py b/fiches/models.py index a750a06..3dbc3cf 100644 --- a/fiches/models.py +++ b/fiches/models.py @@ -13,7 +13,9 @@ class Profile(models.Model): ) full_name = models.CharField(max_length=1023, verbose_name=_("nom")) nickname = models.CharField(blank=True, max_length=1023, verbose_name=_("surnom")) - pronoun = models.CharField(blank=True, max_length = 1023, verbose_name=_("pronom(s) utilisé(s)")) + pronoun = models.CharField( + blank=True, max_length=1023, verbose_name=_("pronom(s) utilisé(s)") + ) picture = models.ImageField( blank=True, upload_to="picture", verbose_name=_("photo") ) @@ -31,12 +33,10 @@ class Profile(models.Model): default=False, verbose_name=_("conserver la fiche annuaire ?") ) - - def __str__(self): return self.full_name - def birthday(): + def birthday(self): return self.birth_date.strftime("%d%m") diff --git a/fiches/templates/fiches/fiches_modif.html b/fiches/templates/fiches/fiches_modif.html index f98dd19..5de135b 100644 --- a/fiches/templates/fiches/fiches_modif.html +++ b/fiches/templates/fiches/fiches_modif.html @@ -1,11 +1,84 @@ {% extends "fiches/base.html" %} +{% load i18n %} + {% block content %} -

Modifier ma page d'annuaire

-
+ + +
+

{% trans "Modifier ma page d'annuaire" %}

+ {% csrf_token %} - {{ form.as_p }} - +
+ + {{ form.full_name }} +
+
+ + {{ form.nickname }} +
+
+ + {{ form.pronoun }} +
+
+ +
+
+ {% if form.instance.picture %} + + + + {% else %} + + {% endif %} +
+
+ {% if form.instance.picture %} +
+ + +
+ {% endif %} +
+ + +
+
+
+
+
+ + {{ form.department }} +
+
+ + {{ form.promotion }} +
+
+ + {{ form.birth_date }} +
+
+ + {{ form.thurne }} +
+
+ +
+ {{ form.text_field }} +
+
+
+ + {{ form.printing }} +
+
+ + {{ form.keep_me }} +
+ +
{% endblock %} diff --git a/fiches/views.py b/fiches/views.py index b9b6902..ab744c7 100644 --- a/fiches/views.py +++ b/fiches/views.py @@ -21,7 +21,8 @@ def fiche(request, user): def fiche_modif(request): profile = request.user.profile if request.method == "POST": - form = ProfileForm(request.POST, instance=profile) + form = ProfileForm(request.POST, request.FILES, instance=profile) + print(request.FILES) if form.is_valid(): form.save() send_mail(