From 1eed5a8283ac5c321752a63f3c652f145c7d2f0a Mon Sep 17 00:00:00 2001 From: reverend Date: Wed, 12 Aug 2020 20:33:09 +0200 Subject: [PATCH] Throwing message when creating a user --- lostplaces/lostplaces_app/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lostplaces/lostplaces_app/views.py b/lostplaces/lostplaces_app/views.py index 956d89c..59e4b03 100644 --- a/lostplaces/lostplaces_app/views.py +++ b/lostplaces/lostplaces_app/views.py @@ -10,6 +10,8 @@ from django.http import Http404 from django.contrib import messages from django.contrib.auth.mixins import UserPassesTestMixin, LoginRequiredMixin +from django.contrib.messages.views import SuccessMessageMixin + from .forms import ( ExplorerCreationForm, PlaceForm, @@ -40,10 +42,11 @@ class IsSubmitter(UserPassesTestMixin, View): self.request, 'You do not have permission to do this.') return False -class SignUpView(CreateView): +class SignUpView(SuccessMessageMixin, CreateView): form_class = ExplorerCreationForm success_url = reverse_lazy('login') template_name = 'signup.html' + success_message = 'User created' class PlaceListView(IsAuthenticated, View): def get(self, request):