Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added MemberEmailForm and put it on index page

  • Loading branch information...
commit 6ac40385439e5dc06bd10fea7e56b00136d36647 1 parent bff399d
@anttihirvonen authored
View
7 dotmembership/apps/members/forms.py
@@ -4,6 +4,7 @@
from django.utils.translation import ugettext_lazy as _
from django.contrib.sites.models import Site
from django.conf import settings
+from django import forms
from generic_confirmation.forms import DeferredForm
@@ -26,3 +27,9 @@ def send_notification(self, user=None, instance=None):
'base_url': "http://{0}".format(Site.objects.get_current().domain),
'first_name': self.cleaned_data['first_name']})
send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [self.cleaned_data['email']])
+
+
+class MemberEmailForm(forms.ModelForm):
+ class Meta:
+ model = Member
+ fields = ("email",)
View
18 dotmembership/apps/members/views.py
@@ -5,7 +5,7 @@
from ajaxutils.decorators import ajax
-from .forms import MemberForm
+from .forms import MemberForm, MemberEmailForm
from dotmembership.apps.billing.models import Invoice
@@ -13,16 +13,14 @@ def index(request):
"""
Index page of the member register.
- Renders a page which contains forms.
+ Renders a page which contains forms for joining and
+ sending a self edit link
"""
- if request.method == "POST":
- form = MemberForm(request.POST)
- if form.is_valid():
- form.save()
- else:
- form = MemberForm()
-
- return render(request, 'index.html', {'member_form': form})
+ member_form = MemberForm()
+ email_form = MemberEmailForm()
+
+ return render(request, 'index.html', {'member_form': member_form,
+ 'email_form': email_form})
@ajax(require_POST=True)
View
11 dotmembership/templates/index.html
@@ -85,6 +85,17 @@
<div class="tab-pane" id="old">
<p>Haluatko tarkistaa tai muokata jäsentietojasi tai tarkastaa jäsenmaksusi tilan? Syötä sähköpostiosoitteesi, jolla olet liittynyt jäseneksi, allaolevaan lomakkeeseen ja saat jäsentietosi sekä lyhytkäyttöisen linkin tietojen muokkaamiseen.</p>
+ <form action="" method="post" class="form-horizontal" id="email-form">
+ {% csrf_token %}
+ {{ email_form|bootstrap }}
+ <div class="controls">
+ <button type="submit" class="btn btn-info btn-large">Tilaa muutoslinkki</button>
+ </div>
+ </form>
+ <div id="join-form-success" class="form-success-box">
+ <h3>Muutoslinkki lähetettiin</h3>
+ <p>Lähetetty!</p>
+ </div>
</div>
</div>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.