mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-07 02:16:26 +00:00
24 lines
743 B
Python
24 lines
743 B
Python
# App de gestion des users pour re2o
|
|
# Goulven Kermarec, Gabriel Détraz
|
|
# Gplv2
|
|
from django.shortcuts import render
|
|
from django.shortcuts import render_to_response, get_object_or_404
|
|
from django.core.context_processors import csrf
|
|
from django.template import Context, RequestContext, loader
|
|
|
|
from users.models import UserForm
|
|
|
|
|
|
def form(ctx, template, request):
|
|
c = ctx
|
|
c.update(csrf(request))
|
|
return render_to_response(template, c, context_instance=RequestContext(request))
|
|
|
|
def new_user(request):
|
|
if request.method == 'POST':
|
|
user = UserForm(request.Post)
|
|
if user.is_valid():
|
|
user.save()
|
|
else:
|
|
user = UserForm()
|
|
return form({'userform': user}, 'users/new_user.html', request)
|