X-Git-Url: https://git.mdrn.pl/prawokultury.git/blobdiff_plain/91117520dbe0336cd5acc91c6d8e23d81141f9df..1ede7c2fdb4bc8345e778ab734b0c3e59fdeb32a:/shop/forms.py?ds=inline
diff --git a/shop/forms.py b/shop/forms.py
index ce8a48f..fedd152 100644
--- a/shop/forms.py
+++ b/shop/forms.py
@@ -1,32 +1,50 @@
# -*- coding: utf-8 -*-
-# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django import forms
from django.utils import formats
from django.utils.translation import ugettext_lazy as _, ugettext, get_language
-from .models import Order
from . import app_settings
+from .models import Order
+from .widgets import NumberInput
class OrderForm(forms.Form):
required_css_class = 'required'
backend = 'getpaid.backends.payu'
-
+ items = forms.IntegerField(label=_("Items"), min_value=1, initial=1,
+ widget=NumberInput(attrs={'min': '1', 'step': '1', 'class': 'cost-items'}))
name = forms.CharField(label=_("Name"))
email = forms.EmailField(label=_("Contact e-mail"))
address = forms.CharField(label=_("Address"), widget=forms.Textarea)
- consent = forms.CharField(label=_("Consent"), widget=forms.Textarea,
- help_text=_('I hereby consent'))
+
+ accept = forms.BooleanField(label=_("Accept terms"),
+ help_text='''AkceptujÄ regulamin sklepu.''')
+
+ consent = forms.BooleanField(label=_("Consent to the processing of data"),
+ help_text='''Wyrażam zgodÄ na przetwarzanie moich danych osobowych w celu realizacji
+zamówienia. Administratorem danych osobowych jest Fundacja Nowoczesna
+Polska, ul. MarszaÅkowska 84/92, lok. 125, 00-514 Warszawa.
+ZapoznaÅem/zapoznaÅam siÄ
+z politykÄ
prywatnoÅci Fundacji.
+Jestem Åwiadom/Åwiadoma, iż moja zgoda może byÄ odwoÅana w każdym czasie, co skutkowaÄ bÄdzie
+usuniÄciem mojego adresu e-mail z bazy danych.''')
def __init__(self, offer, *args, **kwargs):
- print 'o:', offer
self.offer = offer
super(OrderForm, self).__init__(*args, **kwargs)
+ self.fields['items'].widget.attrs.update({
+ 'data-cost-price': self.offer.price,
+ 'data-cost-per-item': self.offer.cost_per_item,
+ 'data-cost-const': self.offer.cost_const,
+ 'data-decimal-separator': formats.get_format("DECIMAL_SEPARATOR"),
+ })
def save(self):
order = Order.objects.create(
offer=self.offer,
+ items=self.cleaned_data['items'],
name=self.cleaned_data['name'],
email=self.cleaned_data['email'],
address=self.cleaned_data['address'],