Handle file upload when editing a fiche
This commit is contained in:
parent
fe6019e5f0
commit
dcef95d5d4
2 changed files with 2 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
{% extends "fiches/base.html" %}
|
{% extends "fiches/base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Modifier ma page d'annuaire</h2>
|
<h2>Modifier ma page d'annuaire</h2>
|
||||||
<form method="post" action="">
|
<form enctype="multipart/form-data" method="post" action="">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{{ form.as_p }}
|
||||||
<input type="submit" value="Enregistrer">
|
<input type="submit" value="Enregistrer">
|
||||||
|
|
|
@ -21,7 +21,7 @@ def fiche(request, user):
|
||||||
def fiche_modif(request):
|
def fiche_modif(request):
|
||||||
profile = request.user.profile
|
profile = request.user.profile
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
form = ProfileForm(request.POST, instance=profile)
|
form = ProfileForm(request.POST, request.FILES, instance=profile)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
send_mail(
|
send_mail(
|
||||||
|
|
Loading…
Add table
Reference in a new issue