From 65de6f33ab7154135a2f934df9ad53d7c82cec22 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 26 Jun 2013 15:29:50 +0200 Subject: [PATCH] Set minimum funding amount. --- apps/funding/forms.py | 15 +++-- apps/funding/locale/pl/LC_MESSAGES/django.mo | Bin 8120 -> 8405 bytes apps/funding/locale/pl/LC_MESSAGES/django.po | 57 ++++++++++++------- wolnelektury/settings/custom.py | 1 + 4 files changed, 47 insertions(+), 26 deletions(-) diff --git a/apps/funding/forms.py b/apps/funding/forms.py index 3bd7f1dd3..dc0e6236d 100644 --- a/apps/funding/forms.py +++ b/apps/funding/forms.py @@ -1,5 +1,7 @@ +from django.conf import settings from django import forms -from django.utils.translation import ugettext_lazy as _, ugettext as __, get_language +from django.utils import formats +from django.utils.translation import ugettext_lazy as _, ugettext, get_language from .models import Funding from .widgets import PerksAmountWidget @@ -21,13 +23,18 @@ class FundingForm(forms.Form): self.fields['amount'].widget.form_instance = self def clean_amount(self): - if self.cleaned_data['amount'] <= 0: - raise forms.ValidationError(__("Enter positive amount.")) + if self.cleaned_data['amount'] < settings.FUNDING_MIN_AMOUNT: + min_amount = settings.FUNDING_MIN_AMOUNT + if isinstance(settings.FUNDING_MIN_AMOUNT, float): + min_amount = formats.number_format(settings.FUNDING_MIN_AMOUNT, 2) + raise forms.ValidationError( + ugettext("The minimum amount is %(amount)s PLN.") % { + 'amount': min_amount}) return self.cleaned_data['amount'] def clean(self): if not self.offer.is_current(): - raise forms.ValidationError(__("This offer is out of date.")) + raise forms.ValidationError(ugettext("This offer is out of date.")) return self.cleaned_data def save(self): diff --git a/apps/funding/locale/pl/LC_MESSAGES/django.mo b/apps/funding/locale/pl/LC_MESSAGES/django.mo index e2cc7575618b1ec1d4687f1403e7e505579a32a3..2027e14792844ec13c8db44e8e185edc17c4e047 100644 GIT binary patch delta 2201 zcmYk+e@vBC9LMoPpacRbP!b3|5D2DFfFL4)P)G_25gOT?J-`JnKkm)TC4^abV=Xpv zYmKG0S$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Dr$En}@15payD2O|Z@Ve>dh(Z$;(Eb?k@tQE$(C z)DFe4Ey|5V%wSG+O{Aj^HP*0l3tD@I&BNpR9RKLfl`#z$M-qUOvFagye4X0ur_Q%zzBiW0C@fgm) zJ2(tem}NN@<8(ZYv+xV9$4R8T7IYowVlLaX4L2eEJ&R%g%4wK|d3X>XVF&6A_pl0i z0JYGgs3SRnI)byPGrsD)jl3Xs57qy%^Cb?T{to%G0F_wgw`?x-gt@33h&W4Jdj)Es zTGze+wSY#{0#>;C2K2WSc_VEHYGH>_N7IISkV{BPSSg|T|0_D1;lxa0HZht|;T{`G zXdoTKL_$SpTTSTo{ZlHqD0CGqRNKyG`d?8sYtcG7Qtt2k`ZARfBZx7Cl8qeklMk$l zP=0XietrzWf6D|{8RXP=L&vJ*E^uwy_AFvDp&a5(^89c794bm0a>7aol^P;KM2Rq= zBT%U&#u0q0{GxAtC86BOCB_mu29=S7wme@I$`nFJGM-S5bTzl^NmQm0yrzB@gP#+U zMD|M&zac{3hdLsuy)|xSm-fj?2Ldf`QoqMVvcln_NTlUuTK|O6`J<>778Mk>1cGZ5 gW-MOSv~F=zV^LO1bMSV1b^5ZnOPSvS`?H?@0y65R<^TWy diff --git a/apps/funding/locale/pl/LC_MESSAGES/django.po b/apps/funding/locale/pl/LC_MESSAGES/django.po index 0543b8ac8..6c35c863b 100644 --- a/apps/funding/locale/pl/LC_MESSAGES/django.po +++ b/apps/funding/locale/pl/LC_MESSAGES/django.po @@ -7,34 +7,34 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-06-25 11:55+0200\n" -"PO-Revision-Date: 2013-04-25 13:03+0100\n" +"POT-Creation-Date: 2013-06-26 15:26+0200\n" +"PO-Revision-Date: 2013-06-26 15:26+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \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" -#: forms.py:10 templates/funding/wlfund.html:28 +#: forms.py:12 templates/funding/wlfund.html:27 msgid "Amount" msgstr "Kwota" -#: forms.py:12 +#: forms.py:14 msgid "Name" msgstr "Imię i nazwisko na listę darczyńców" -#: forms.py:13 +#: forms.py:15 msgid "Optional name for public list of contributors" msgstr "Opcjonalnie imię i nazwisko lub pseudonim do listy darczyńców." -#: forms.py:14 +#: forms.py:16 msgid "Contact e-mail" msgstr "E-mail kontaktowy" -#: forms.py:15 +#: forms.py:17 msgid "" "We'll use it to contact you about your perks and fundraiser status and " "payment updates.
Won't be publicised." @@ -42,6 +42,15 @@ msgstr "" "Użyjemy go do kontaktu w sprawie prezentów i informacji o zmianach statusu " "zbiórki i kolejnych akcjach.
Nie będzie publikowany." +#: forms.py:28 +#, python-format +msgid "The minimum amount is %(amount)s PLN." +msgstr "Minimalna kwota wpłaty to %(amount)s zł." + +#: forms.py:34 +msgid "This offer is out of date." +msgstr "Ta zbiórka jest już nieaktywna." + #: models.py:19 msgid "author" msgstr "autor" @@ -54,7 +63,7 @@ msgstr "tytuł" msgid "slug" msgstr "slug" -#: models.py:22 models.py:117 +#: models.py:22 msgid "description" msgstr "opis" @@ -114,6 +123,10 @@ msgstr "cena" msgid "name" msgstr "nazwa" +#: models.py:117 +msgid "long name" +msgstr "długa nazwa" + #: models.py:118 msgid "end date" msgstr "data końcowa" @@ -130,7 +143,7 @@ msgstr "prezenty" msgid "email" msgstr "e-mail" -#: models.py:138 models.py:167 +#: models.py:138 models.py:168 msgid "amount" msgstr "kwota" @@ -138,27 +151,27 @@ msgstr "kwota" msgid "payed at" msgstr "data wpłaty" -#: models.py:150 +#: models.py:151 msgid "funding" msgstr "wpłata" -#: models.py:151 +#: models.py:152 msgid "fundings" msgstr "wpłaty" -#: models.py:168 +#: models.py:169 msgid "when" msgstr "kiedy" -#: models.py:171 +#: models.py:172 msgid "money spent on a book" msgstr "pieniądze wydane na książkę" -#: models.py:172 +#: models.py:173 msgid "money spent on books" msgstr "pieniądze wydane na książki" -#: models.py:202 templates/funding/thanks.html:6 +#: models.py:203 templates/funding/thanks.html:6 #: templates/funding/thanks.html.py:13 msgid "Thank you for your support!" msgstr "Dziękujemy za Twoje wsparcie!" @@ -324,23 +337,23 @@ msgstr "" msgid "Spending these remaining funds is recorded in this table." msgstr "W poniższej tabeli rejetrujemy wydatkowanie tych środków." -#: templates/funding/wlfund.html:26 +#: templates/funding/wlfund.html:25 msgid "Date" msgstr "Data" -#: templates/funding/wlfund.html:27 +#: templates/funding/wlfund.html:26 msgid "Operation" msgstr "Rozdysponowanie środków" -#: templates/funding/wlfund.html:29 +#: templates/funding/wlfund.html:28 msgid "Balance" msgstr "Bilans" -#: templates/funding/wlfund.html:36 +#: templates/funding/wlfund.html:35 msgid "Money spent on publishing the book" msgstr "Pieniądze przeznaczone na opublikowanie książki" -#: templates/funding/wlfund.html:45 +#: templates/funding/wlfund.html:44 msgid "Money remaining from the fundraiser for" msgstr "Pieniądze pozostałe ze zbiórki na" diff --git a/wolnelektury/settings/custom.py b/wolnelektury/settings/custom.py index 8e2489d79..6cd036a96 100644 --- a/wolnelektury/settings/custom.py +++ b/wolnelektury/settings/custom.py @@ -18,3 +18,4 @@ CATALOGUE_CUSTOMPDF_RATE_LIMIT = '1/m' LIBRARIAN_PDF_MOREFLOATS = None FUNDING_DEFAULT = 20 +FUNDING_MIN_AMOUNT = 1 -- 2.20.1