add reminder form
authorJan Szejko <janek37@gmail.com>
Wed, 1 Aug 2018 14:31:09 +0000 (16:31 +0200)
committerJan Szejko <janek37@gmail.com>
Thu, 2 Aug 2018 14:33:09 +0000 (16:33 +0200)
contact/forms.py
contact/templates/contact/form.html
contact/views.py
edumed/contact_forms.py
edumed/static/css/main.css
edumed/static/css/main.scss
edumed/templates/flatpages/default.html

index 97fc027..0d09334 100644 (file)
@@ -41,6 +41,7 @@ class ContactForm(forms.Form):
 
     required_css_class = 'required'
     contact = NotImplemented
+    data_processing = None
 
     def save(self, request, formsets=None):
         from .models import Attachment, Contact
index 584629a..7b38415 100644 (file)
@@ -19,6 +19,7 @@
     {% render_honeypot_field %}
     <table>
         {{ form.as_table }}
+        {% if form.data_processing %}<tr><td></td><td><div class="helptext">{{ form.data_processing }}</div></td></tr>{% endif %}
         <tr><td></td><td><button>{% block contact_form_submit %}{{ form.submit_label }}{% endblock %}</button></td></tr>
     </table>
     </form>
index 84578dc..86c8417 100644 (file)
@@ -24,7 +24,7 @@ def form(request, form_tag, force_enabled=False):
         raise Http404
     if not (force_enabled and request.user.is_superuser):
         disabled = getattr(form_class, 'disabled', False)
-        end_tuple = getattr(form_class, 'ends_on')
+        end_tuple = getattr(form_class, 'ends_on', None)
         end_time = localtime_to_utc(datetime(*end_tuple)) if end_tuple else None
         expired = end_time and end_time < timezone.now()
         if disabled or expired:
index 022b02d..01f3276 100644 (file)
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 from django import forms
 from django.forms.formsets import BaseFormSet
+from django.utils.safestring import mark_safe
 
 from contact.forms import ContactForm
 from django.utils.translation import ugettext_lazy as _
@@ -27,6 +28,23 @@ WOJEWODZTWA = (
 WOJEWODZTWO_CHOICES = [(u'', u'(wybierz)')] + [(w, w) for w in WOJEWODZTWA]
 
 
+def make_data_processing(middle_text):
+    return mark_safe(u'''\
+Administratorem danych osobowych jest Fundacja Nowoczesna Polska (ul. Marszałkowska 84/92 lok. 125, 00-514 Warszawa). \
+Podanie danych osobowych jest dobrowolne. %s Osobom, których dane są zbierane, przysługuje prawo dostępu do treści \
+swoich danych oraz ich poprawiania. Więcej informacji w <a href="https://nowoczesnapolska.org.pl/prywatnosc/">\
+polityce prywatności</a>.''' % middle_text)
+
+
+class ReminderForm(ContactForm):
+    form_tag = 'nie-przegap-2018'
+    form_title = u'Rejestracja. Nie przegap terminu!'
+    email = forms.EmailField(label=u'Adres e-mail', max_length=128)
+    data_processing = make_data_processing(
+        u'Dane są przetwarzane w zakresie niezbędnym do wysłania powiadomienia odbiorcom.')
+    submit_label = u'Wyślij'
+
+
 class WTEMStudentForm(forms.Form):
     first_name = forms.CharField(label=u'Imię', max_length=128)
     last_name = forms.CharField(label=u'Nazwisko', max_length=128)
index e9c2ac1..08fb109 100644 (file)
     margin-bottom: 1em;
     width: 10em;
     float: left; }
-    #main-promobox a:first-of-type {
-      padding-top: 0;
-      border-top-right-radius: 0;
-      border-top-left-radius: 0; }
     #main-promobox a:last-of-type {
       margin-bottom: 0; }
   #main-promobox h1 {
       margin: 1.1em 0 0 0;
       font-size: .9em;
       line-height: 1.15em; }
+
+/*# sourceMappingURL=main.css.map */
index 7d95145..d06205f 100755 (executable)
@@ -20,11 +20,6 @@ $px: .0625em;
     width: 220*$px - 3 * 20*$px;
     float: left;
 
-    &:first-of-type {
-      padding-top: 0;
-      border-top-right-radius: 0;
-      border-top-left-radius: 0;
-    }
     &:last-of-type {
       margin-bottom: 0;
     }
index 1ab012c..f26cc8a 100755 (executable)
@@ -1,9 +1,14 @@
 {% extends "base.html" %}
 {% load textile_pl from fnp_markup %}
+{% load chunk from chunks %}
 
 {% block title %}{{ flatpage.title }}{% endblock %}
 
 {% block body %}
+<section id="main-promobox">
+  {% chunk "promobox" %}
+</section>
+
 <div id="main-bar" class="flatpage">
 {{ flatpage.content|textile_pl }}
 </div>