Permalink
Browse files

Added MemberEmailForm and put it on index page

  • Loading branch information...
1 parent bff399d commit 6ac40385439e5dc06bd10fea7e56b00136d36647 @anttihirvonen committed Sep 13, 2012
Showing with 26 additions and 10 deletions.
  1. +7 −0 dotmembership/apps/members/forms.py
  2. +8 −10 dotmembership/apps/members/views.py
  3. +11 −0 dotmembership/templates/index.html
@@ -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",)
@@ -5,24 +5,22 @@
from ajaxutils.decorators import ajax
-from .forms import MemberForm
+from .forms import MemberForm, MemberEmailForm
from dotmembership.apps.billing.models import Invoice
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)
@@ -85,6 +85,17 @@ <h3>Tiedot tallennettu – käy aktivoimassa jäsenyytesi</h3>
<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>

0 comments on commit 6ac4038

Please sign in to comment.