diff --git a/pgweb/lists/forms.py b/pgweb/lists/forms.py index 7648b85d..36185b05 100644 --- a/pgweb/lists/forms.py +++ b/pgweb/lists/forms.py @@ -3,6 +3,8 @@ from django import forms from models import MailingList class SubscribeForm(forms.Form): + jquery = True + email = forms.EmailField(max_length=100,required=True,label="Email address") action = forms.ChoiceField(required=True, choices=(('subscribe','Subscribe'),('unsubscribe','Unsubscribe'))) receive = forms.BooleanField(required=False, label="Receive mail", initial=True) diff --git a/pgweb/lists/views.py b/pgweb/lists/views.py index 7ec93126..256bf55d 100644 --- a/pgweb/lists/views.py +++ b/pgweb/lists/views.py @@ -46,9 +46,10 @@ def subscribe(request): # GET, so render up the form form = SubscribeForm() - return render_to_response('base/form.html', { + return render_to_response('lists/subscribe_form.html', { 'form': form, 'operation': 'Subscribe', + 'jquery': True, 'form_intro': """ Please do not subscribe to mailing lists using e-mail accounts protected by mail-back anti-spam systems. These are extremely annoying to the list maintainers diff --git a/pgweb/util/helpers.py b/pgweb/util/helpers.py index 817f416e..71134bd2 100644 --- a/pgweb/util/helpers.py +++ b/pgweb/util/helpers.py @@ -58,6 +58,7 @@ def simple_form(instancetype, itemid, request, formclass, formtemplate='base/for 'markdownfields': markdownfields, 'form_intro': hasattr(form, 'form_intro') and form.form_intro or None, 'toggle_fields': hasattr(form, 'toggle_fields') and form.toggle_fields or None, + 'jquery': hasattr(form, 'jquery') and form.jquery or None, 'savebutton': (itemid == "new") and "New" or "Save", 'operation': (itemid == "new") and "New" or "Edit", }, NavContext(request, navsection)) diff --git a/templates/base/form.html b/templates/base/form.html index 3cc4e472..067456e5 100644 --- a/templates/base/form.html +++ b/templates/base/form.html @@ -42,6 +42,9 @@ {% block extrahead %} {{ block.super }} +{%if toggle_fields or jquery %} + +{%endif%} {%if markdownfields%} @@ -53,8 +56,7 @@ {%endfor%} } -{%if toggle_fields%} - +{%if toggle_fields %} +{%endblock%}