Throwing message when creating a user

This commit is contained in:
reverend 2020-08-12 20:33:09 +02:00
parent 4ebc8f93f7
commit 1eed5a8283

View File

@ -10,6 +10,8 @@ from django.http import Http404
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import UserPassesTestMixin, LoginRequiredMixin from django.contrib.auth.mixins import UserPassesTestMixin, LoginRequiredMixin
from django.contrib.messages.views import SuccessMessageMixin
from .forms import ( from .forms import (
ExplorerCreationForm, ExplorerCreationForm,
PlaceForm, PlaceForm,
@ -40,10 +42,11 @@ class IsSubmitter(UserPassesTestMixin, View):
self.request, 'You do not have permission to do this.') self.request, 'You do not have permission to do this.')
return False return False
class SignUpView(CreateView): class SignUpView(SuccessMessageMixin, CreateView):
form_class = ExplorerCreationForm form_class = ExplorerCreationForm
success_url = reverse_lazy('login') success_url = reverse_lazy('login')
template_name = 'signup.html' template_name = 'signup.html'
success_message = 'User created'
class PlaceListView(IsAuthenticated, View): class PlaceListView(IsAuthenticated, View):
def get(self, request): def get(self, request):