2017-02-21 16:56:34 +01:00
|
|
|
from .forms import CreateUserForm
|
2017-02-18 01:45:22 +01:00
|
|
|
from django.views.generic.edit import CreateView
|
|
|
|
from django.contrib.messages.views import SuccessMessageMixin
|
2018-08-27 00:30:12 +02:00
|
|
|
from django.urls import reverse_lazy
|
2017-02-18 01:45:22 +01:00
|
|
|
|
2017-02-21 17:48:56 +01:00
|
|
|
|
2017-02-18 01:45:22 +01:00
|
|
|
class CreateUser(SuccessMessageMixin, CreateView):
|
2017-02-21 20:50:32 +01:00
|
|
|
template_name = 'users/user_form.html'
|
2017-02-21 17:48:56 +01:00
|
|
|
form_class = CreateUserForm
|
|
|
|
success_url = reverse_lazy('shared:home')
|
2017-02-18 01:45:22 +01:00
|
|
|
success_message = "Votre compte utilisateur a été correctement créé !"
|
2017-02-21 17:48:56 +01:00
|
|
|
|
2017-02-18 01:45:22 +01:00
|
|
|
def get_context_data(self, **kwargs):
|
2017-04-26 04:08:25 +02:00
|
|
|
ctx = super().get_context_data(**kwargs)
|
2017-02-21 17:48:56 +01:00
|
|
|
ctx['button'] = 'Créer'
|
2017-02-21 11:07:36 +01:00
|
|
|
ctx['page_title'] = "Création d'utilisateur"
|
2017-02-18 01:45:22 +01:00
|
|
|
return ctx
|