From dcef95d5d4be32022fd9d06b8df3a9469149686d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Tue, 15 Sep 2020 21:10:36 +0200 Subject: [PATCH] Handle file upload when editing a fiche --- fiches/templates/fiches/fiches_modif.html | 2 +- fiches/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fiches/templates/fiches/fiches_modif.html b/fiches/templates/fiches/fiches_modif.html index f98dd19..b8a1c06 100644 --- a/fiches/templates/fiches/fiches_modif.html +++ b/fiches/templates/fiches/fiches_modif.html @@ -1,7 +1,7 @@ {% extends "fiches/base.html" %} {% block content %}

Modifier ma page d'annuaire

-
+ {% csrf_token %} {{ form.as_p }} diff --git a/fiches/views.py b/fiches/views.py index b9b6902..49eb34a 100644 --- a/fiches/views.py +++ b/fiches/views.py @@ -21,7 +21,7 @@ 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) if form.is_valid(): form.save() send_mail(