50b667993f
- Mise en page - Cleanup des petits cours - Utilisation de custommail - Utilisation du ldap du SPI pour fetch les nouveaux comptes
24 lines
851 B
Python
24 lines
851 B
Python
from django.shortcuts import render
|
|
from django.contrib.auth.decorators import login_required
|
|
|
|
from .forms import ProfileForm, UserForm
|
|
|
|
|
|
@login_required
|
|
def profile(request):
|
|
success = False
|
|
if request.method == "POST":
|
|
user_form = UserForm(request.POST, instance=request.user)
|
|
if user_form.is_valid():
|
|
user = user_form.save()
|
|
profile_form = ProfileForm(request.POST, instance=user.profile)
|
|
if profile_form.is_valid():
|
|
profile_form.save()
|
|
success = True
|
|
else:
|
|
user = request.user
|
|
user_form = UserForm(instance=user)
|
|
profile_form = ProfileForm(instance=user.profile)
|
|
return render(request, "gestion/profile.html",
|
|
{"user_form": user_form, "profile_form": profile_form,
|
|
"success": success})
|