Handle file upload when editing a fiche

This commit is contained in:
Martin Pépin 2020-09-15 21:10:36 +02:00
parent fe6019e5f0
commit dcef95d5d4
No known key found for this signature in database
GPG key ID: E7520278B1774448
2 changed files with 2 additions and 2 deletions

View file

@ -1,7 +1,7 @@
{% extends "fiches/base.html" %}
{% block content %}
<h2>Modifier ma page d'annuaire</h2>
<form method="post" action="">
<form enctype="multipart/form-data" method="post" action="">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Enregistrer">

View file

@ -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(