poulpe/user/views.py
2017-04-26 04:08:25 +02:00

17 lines
649 B
Python

from user.forms import CreateUserForm
from django.views.generic.edit import CreateView
from django.contrib.messages.views import SuccessMessageMixin
from django.core.urlresolvers import reverse_lazy
class CreateUser(SuccessMessageMixin, CreateView):
template_name = 'user/user_form.html'
form_class = CreateUserForm
success_url = reverse_lazy('shared:home')
success_message = "Votre compte utilisateur a été correctement créé !"
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
ctx['button'] = 'Créer'
ctx['page_title'] = "Création d'utilisateur"
return ctx