From: Radek Czajka Date: Wed, 26 Jun 2013 13:29:50 +0000 (+0200) Subject: Set minimum funding amount. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/65de6f33ab7154135a2f934df9ad53d7c82cec22 Set minimum funding amount. --- 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 e2cc75756..2027e1479 100644 Binary files a/apps/funding/locale/pl/LC_MESSAGES/django.mo and b/apps/funding/locale/pl/LC_MESSAGES/django.mo differ 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