Commit 423bff39 authored by frekk's avatar frekk
Browse files

added post-registration thankyou

parent 7233f19b
......@@ -51,8 +51,8 @@ class RegisterForm(MyModelForm):
m = super().save(commit=False)
if (m.display_name == ""):
m.display_name = "%s %s" % (m.first_name, m.last_name);
if (commit):
# must save otherwise membership creation will fail
# now create a corresponding Membership (marked as pending / not accepted, mostly default values)
ms = make_pending_membership(m)
......@@ -90,7 +90,8 @@ class RegisterView(MyUpdateView):
def form_valid(self, form):
# save the member data and get the Member instance
m, ms =
return HttpResponseRedirect(reverse("memberdb:home"))
#messages.success(self.request, 'Your registration has been submitted.')
return HttpResponseRedirect(reverse("memberdb:thanks"))
class RenewView(LoginRequiredMixin, MyUpdateView):
template_name = 'renew.html'
......@@ -112,11 +113,11 @@ class RenewView(LoginRequiredMixin, MyUpdateView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
'is_new': self.object == None,
'is_new': Member.objects.filter(username__exact=self.request.user.username).count() == 0,
return context
def form_valid(self, form):
m, ms =
messages.success(self.request, 'Your membership renewal has been submitted.')
return HttpResponseRedirect(reverse("memberdb:home"))
{% extends "register.html" %}
{% block content-title %}
{% endblock %}
{% block tips %}
<b>Your membership registration has been submitted.</b><br><br>
Once it has been approved, you will receive an email with instructions to activate your account.
{% endblock %}
{% block form %}{% endblock %}
\ No newline at end of file
from django.urls import path
from django.contrib.auth import views as auth_views
from django.views.generic.base import TemplateView
from . import views
from .views import MemberHomeView
......@@ -8,6 +9,7 @@ from .register import RegisterView, RenewView
app_name = 'memberdb'
urlpatterns = [
path('', MemberHomeView.as_view(), name='home'),
path('', MemberHomeView.as_view(), name='index'),
path('login/', auth_views.LoginView.as_view(template_name='login.html'), name='login'),
path('logout/', auth_views.LogoutView.as_view(template_name='logout.html'), name='logout'),
......@@ -18,5 +20,6 @@ urlpatterns = [
path('register/', RegisterView.as_view(), name='register'),
path('renew/', RenewView.as_view(), name='renew'),
path('active/', views.getactive, name='actives'),
path('thanks/', TemplateView.as_view(template_name='thanks.html'), name='thanks'),
#path('<str:username>/',, name='info'),
\ No newline at end of file
......@@ -3,6 +3,7 @@ from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from django.forms import ModelForm
from django.contrib import messages
from django.views.generic.edit import UpdateView
from django.contrib.auth.mixins import LoginRequiredMixin
......@@ -63,3 +64,8 @@ class MemberHomeView(LoginRequiredMixin, MyUpdateView):
'memberships': m.memberships.all() if m is not None else None,
return d
def form_valid(self, form):
messages.success(self.request, 'Member details updated.')
# redirect to ourselves?!! because I can't think of a less hacky way to do this
return HttpResponseRedirect(reverse('memberdb:home'))
Supports Markdown
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