Commit fac275e9 authored by Hamza Dely's avatar Hamza Dely
Browse files

[comptes/views] Nettoyage de la vue de création d'un adhérent

parent dbfec188
......@@ -14,7 +14,7 @@ from django.shortcuts import redirect, get_object_or_404
from django.core.exceptions import PermissionDenied, ValidationError
from django.views.generic.detail import DetailView
from django.views.generic.edit import FormView, UpdateView, DeleteView
from django.views.generic.edit import FormView, CreateView, UpdateView, DeleteView
from django.contrib import messages
from django.contrib.auth.forms import PasswordChangeForm
......@@ -82,7 +82,7 @@ class NotePasswordResetCompleteView(NoteMixin, PasswordResetCompleteView):
### Vues concernant le modèle Adhérent
class AdherentInscriptionView(NoteMixin, LoginRequiredMixin, PermissionRequiredMixin, FormView):
class AdherentInscriptionView(NoteMixin, LoginRequiredMixin, PermissionRequiredMixin, CreateView):
"""
Vue pour l'inscription d'un nouvel adhérent dans la base de données.
"""
......@@ -94,7 +94,6 @@ class AdherentInscriptionView(NoteMixin, LoginRequiredMixin, PermissionRequiredM
form_class = AdherentInscriptionForm
def form_valid(self, form):
self.adherent = form.save()
user = self.request.user
if (form.cleaned_data['type'] in [Adherent.CLUB, Adherent.SECTION] and
not user.has_perm("comptes.adherent_inscrire", Acl.ETENDU)):
......@@ -114,9 +113,6 @@ class AdherentInscriptionView(NoteMixin, LoginRequiredMixin, PermissionRequiredM
pass
return super().form_valid(form)
def get_success_url(self, *args, **kwargs):
return reverse_lazy('comptes:detail', kwargs={'pk' : self.adherent.id})
class AdherentDetailView(NoteMixin, LoginRequiredMixin, PermissionRequiredMixin, DetailView):
"""
Vue pour l'affichage des données d'un adhérent
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment