From 47351ab5748512a764719340c653bc7481b87f1a Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 2 Apr 2014 16:39:51 +0200 Subject: [PATCH] Changing registration form. --- contact/forms.py | 6 +- prawokultury/contact_forms.py | 19 ++++-- prawokultury/locale/pl/LC_MESSAGES/django.mo | Bin 3584 -> 3696 bytes prawokultury/locale/pl/LC_MESSAGES/django.po | 61 ++++++++++-------- .../templates/contact/register/form.html | 41 ++++++++++-- .../templates/contact/register/mail_body.txt | 2 +- 6 files changed, 89 insertions(+), 40 deletions(-) diff --git a/contact/forms.py b/contact/forms.py index 142d209..4199dd7 100644 --- a/contact/forms.py +++ b/contact/forms.py @@ -27,7 +27,9 @@ class ContactForm(forms.Form): """Subclass and define some fields.""" __metaclass__ = ContactFormMeta + started = False form_tag = None + save_as_tag = None form_title = _('Contact form') submit_label = _('Submit') admin_list = None @@ -40,10 +42,11 @@ class ContactForm(forms.Form): for name, value in self.cleaned_data.items(): if not isinstance(value, UploadedFile) and name != 'contact': body[name] = value + save_as_tag = self.save_as_tag or self.form_tag contact = Contact.objects.create(body=body, ip=request.META['REMOTE_ADDR'], contact=self.cleaned_data['contact'], - form_tag=self.form_tag) + form_tag=self.save_as_tag) for name, value in self.cleaned_data.items(): if isinstance(value, UploadedFile): attachment = Attachment(contact=contact, tag=name) @@ -56,6 +59,7 @@ class ContactForm(forms.Form): 'site_name': site.name, 'site_domain': site.domain, 'contact': contact, + 'form': self, } context = RequestContext(request) mail_managers_subject = render_to_string([ diff --git a/prawokultury/contact_forms.py b/prawokultury/contact_forms.py index bb6a54c..a50840e 100644 --- a/prawokultury/contact_forms.py +++ b/prawokultury/contact_forms.py @@ -8,6 +8,10 @@ from django.utils.translation import ugettext_lazy as _ class RegistrationForm(ContactForm): form_tag = 'register' + + save_as_tag = '2014' + conference_name = u'CopyCamp 2014' + form_title = _('Take part!') admin_list = ['name', 'organization', 'title'] @@ -16,11 +20,11 @@ class RegistrationForm(ContactForm): organization = forms.CharField(label=_('Organization'), max_length=256, required=False) title = forms.CharField(label=_('Title of presentation'), - max_length=256, required=False, widget = forms.HiddenInput) + max_length=256, required=False) presentation = forms.FileField(label=_('Presentation'), - required=False, widget = forms.HiddenInput) + required=False) summary = forms.CharField(label=_('Summary of presentation (max. 1800 characters)'), - widget=forms.HiddenInput, max_length=1800, required=False) + max_length=1800, required=False) agree_data = forms.BooleanField( label=_('Permission for data processing'), help_text=_(u'I hereby grant Modern Poland Foundation (Fundacja Nowoczesna Polska, ul. Marszałkowska 84/92, 00-514 Warszawa) permission to process my personal data (name, e-mail address) for purposes of registration for CopyCamp conference.') @@ -32,10 +36,17 @@ class RegistrationForm(ContactForm): def __init__(self, *args, **kwargs): super(RegistrationForm, self).__init__(*args, **kwargs) - self.limit_reached = Contact.objects.filter(form_tag=self.form_tag).count() >= settings.REGISTRATION_LIMIT + + self.started = getattr(settings, 'REGISTRATION_STARTED', False) + self.open_call = getattr(settings, 'REGISTRATION_OPEN_CALL', False) + self.limit_reached = Contact.objects.filter(form_tag=self.save_as_tag).count() >= settings.REGISTRATION_LIMIT if self.limit_reached: for field in ('title', 'summary'): self.fields[field].required = True + if not self.open_call: + for field in ('title', 'summary', 'presentation'): + del self.fields[field] + class NextForm(ContactForm): form_tag = 'next' diff --git a/prawokultury/locale/pl/LC_MESSAGES/django.mo b/prawokultury/locale/pl/LC_MESSAGES/django.mo index 9d25776bdca0b3e61b63aec5fa53d787a01cdb17..f5344dccfe00739362979a845209f43d76602855 100644 GIT binary patch delta 750 zcmYk(Pe>GT6u|K}?ykFzt83aHtyKm=DRS1CO-=8Wi~?jbg! zQ_yJ%JaiQbyUisJ!CthBhoW0V6kX~NcoM=6eShOD`Pkp@^LA#K_kM34rw`M$uieoX zLiDoItS_t~)=Q0zuv$bCXyY@?VJq(8YdpXoxE>LCi*r$t3G9i9kjh=`zyc=mK6c_F z4v5sGN^+44Tj2vfssatn;Cs~Z2p^%w&6`-mQEcD{9^yIdkDnC2hTk~EB&q}SwTV2z zLF7@{#%=1$8(rM&B*SPkmu{RzHM%7XzXJb6m~;@Tsb-ufVe&ykXOP264@FgALV3&GWs&(Q1t)&?UT)6Qna$a^c*d}(>5-Wl6Z z3|*f0+=VM^{`Xj$7A?CAUj0{VVSLQA_+<@yB4=Ayt*m9~#ezBGte4lyo@?GJRh*oW zwd~W++4bf4)B4}|yGv90ta;mUoz+ssTg@3o&v{U;7ODIHP6u|K_2J>LNAElvLS>ST-mDe<+hLq&Bx0o_bl1H8?MPegaxY=3Q2pgNb zQOXJ{iz&8jY($E(l7;`7SUBD9``x~K?|063?t6GWy!Kd7;JCciw8CC0*8o=6eC zBA0wK>BfG_*N)U+8OBhbkDzWmh6avf2>0*+4{;bfS!}~yti>BF!8i1fKNB2I=%n}< zT7-rs(*iW~_h_=e&<(VmdQ$eu6jY4bF%Fh#J^3?H_-iThmqg+-vn%n$)GRk{EUVP( zjOAR1{uU#)X*IibxdD&U?i*}rHp~vgvLluqHO+d{HqGGhkTIHEnwX!MnKpV73(2T{ wVjGranC%hEirThw;oA%jB&Jh~i4>2WF8`%l8HjtG$^3M|zeJ60Z>ZMu19at6(*OVf diff --git a/prawokultury/locale/pl/LC_MESSAGES/django.po b/prawokultury/locale/pl/LC_MESSAGES/django.po index dbeb717..2f92a5b 100644 --- a/prawokultury/locale/pl/LC_MESSAGES/django.po +++ b/prawokultury/locale/pl/LC_MESSAGES/django.po @@ -7,50 +7,50 @@ msgid "" msgstr "" "Project-Id-Version: prawokultury\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-12 12:00+0200\n" -"PO-Revision-Date: 2012-11-08 11:22+0100\n" +"POT-Creation-Date: 2014-04-02 16:10+0200\n" +"PO-Revision-Date: 2014-04-02 16:11+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: FNP \n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2)\n" +"|| n%100>=20) ? 1 : 2);\n" +"X-Generator: Poedit 1.5.4\n" -#: contact_forms.py:11 menu_items.py:22 +#: contact_forms.py:16 menu_items.py:22 msgid "Take part!" msgstr "Weź udział!" -#: contact_forms.py:14 +#: contact_forms.py:19 contact_forms.py:49 msgid "Name" msgstr "Imię i nazwisko" -#: contact_forms.py:15 +#: contact_forms.py:20 contact_forms.py:50 msgid "E-mail" msgstr "E-mail" -#: contact_forms.py:16 +#: contact_forms.py:21 contact_forms.py:51 msgid "Organization" msgstr "Organizacja" -#: contact_forms.py:18 +#: contact_forms.py:23 msgid "Title of presentation" msgstr "Tytuł prezentacji" -#: contact_forms.py:20 +#: contact_forms.py:25 msgid "Presentation" msgstr "Prezentacja" -#: contact_forms.py:22 +#: contact_forms.py:27 msgid "Summary of presentation (max. 1800 characters)" msgstr "Krótki opis prezentacji (maks. 1800 znaków)" -#: contact_forms.py:25 +#: contact_forms.py:30 msgid "Permission for data processing" msgstr "Zgoda na przetwarzanie danych" -#: contact_forms.py:26 +#: contact_forms.py:31 msgid "" "I hereby grant Modern Poland Foundation (Fundacja Nowoczesna Polska, ul. " "Marszałkowska 84/92, 00-514 Warszawa) permission to process my personal data " @@ -60,11 +60,11 @@ msgstr "" "poczty elektronicznej) przez Fundację Nowoczesna Polska (ul. Marszałkowska " "84/92, 00-514 Warszawa) w związku z rejestracją na konferencję CopyCamp." -#: contact_forms.py:29 +#: contact_forms.py:34 msgid "Permission for publication" msgstr "Zgoda na publikację" -#: contact_forms.py:30 +#: contact_forms.py:35 msgid "" "I agree to having materials recorded during the conference released under " "the terms of CC BY-SA." +#: contact_forms.py:47 +msgid "Next CopyCamp" +msgstr "Kolejny CopyCamp" + #: settings.d/60-custom.py:5 msgid "info" -msgstr "" +msgstr "info" #: templates/404.html:5 templates/404.html.py:10 msgid "Page not found" @@ -112,26 +116,27 @@ msgstr "" "href='http://creativecommons.org/licenses/by-sa/3.0/deed.pl'>Creative " "Commons Uznanie autorstwa – Na tych samych warunkach." -#: templates/contact/register/mail_body.txt:2 -#: templates/contact/register/mail_subject.txt:1 +#: templates/contact/register/mail_body.txt:4 #, python-format -msgid "Thank you for submitting the registration form at %(site_name)s." -msgstr "" -"Dziękujemy za wypełnienie formularza rejestracyjnego na stronie " -"%(site_name)s." - -#: templates/contact/register/mail_body.txt:3 msgid "" -"Thank you for registering to the CopyCamp 2013 conference.\n" +"Thank you for registering to the %(conf)s conference.\n" "Please arrive early to obtain your name badge and conference materials." msgstr "" -"Dziękujemy za rejestrację na konferencję CopyCamp 2013." -"Prosimy o wcześniejsze przybycie w celu otrzymania identyfikatora i materiałów konferencyjnych." +"Dziękujemy za rejestrację na konferencję %(conf)s.\n" +"Prosimy o wcześniejsze przybycie w celu otrzymania identyfikatora i " +"materiałów konferencyjnych." -#: templates/contact/register/mail_body.txt:7 +#: templates/contact/register/mail_body.txt:8 msgid "Message sent automatically. Please do not reply to it." msgstr "Wiadomość wysłana automatycznie, prosimy nie odpowiadać." +#: templates/contact/register/mail_subject.txt:1 +#, python-format +msgid "Thank you for submitting the registration form at %(site_name)s." +msgstr "" +"Dziękujemy za wypełnienie formularza rejestracyjnego na stronie " +"%(site_name)s." + #: templates/contact/register/thanks.html:5 msgid "Thank you for submitting the registration form." msgstr "Dziękujemy za wypełnienie formularza rejestracyjnego." diff --git a/prawokultury/templates/contact/register/form.html b/prawokultury/templates/contact/register/form.html index 2c19f4d..516fcfe 100644 --- a/prawokultury/templates/contact/register/form.html +++ b/prawokultury/templates/contact/register/form.html @@ -12,19 +12,48 @@ {% endblock %} - {% if form.limit_reached %} +{% if not form.started %} + {# Not yet started. #} +
+ {% chunk "contact_form__"|add:form.form_tag|add:"__not_started" %} +
+{% else %} + {# Already started. #} + {% if form.limit_reached and not form.open_call %} + {# Already closed. #}
- {% chunk "contact_form__"|add:form.form_tag|add:"__full" %} + {% chunk "contact_form__"|add:form.form_tag|add:"__closed" %}
{% else %} + {# Still running. #} + {% if form.limit_reached %} + {# Only taking presentation submissions. #} +
+ {% chunk "contact_form__"|add:form.form_tag|add:"__presentations_only" %} +
+ {% else %} + {% if not form.open_call %} + {# Not taking presentations any more. #} +
+ {% chunk "contact_form__"|add:form.form_tag|add:"__no_presentations" %} +
+ {% else %} +
+ {% chunk "contact_form__"|add:form.form_tag|add:"__running" %} +
+ {% endif %} + {% endif %} +
- {% csrf_token %} - + {% csrf_token %} +
{{ form.as_table }} -
+
{% endif %} - +{% endif %} + + {% endblock %} diff --git a/prawokultury/templates/contact/register/mail_body.txt b/prawokultury/templates/contact/register/mail_body.txt index 2c256cc..3d5cbed 100755 --- a/prawokultury/templates/contact/register/mail_body.txt +++ b/prawokultury/templates/contact/register/mail_body.txt @@ -1,6 +1,6 @@ {% load i18n %} {% comment %}{% blocktrans %}Thank you for submitting the registration form at {{ site_name }}.{% endblocktrans %}{% endcomment %} -{% blocktrans %}Thank you for registering to the CopyCamp 2013 conference. +{% blocktrans with conf=form.conference_name %}Thank you for registering to the {{conf}} conference. Please arrive early to obtain your name badge and conference materials.{% endblocktrans %} -- -- 2.20.1