From: Radek Czajka Date: Wed, 19 May 2021 13:04:03 +0000 (+0200) Subject: Record club payment source. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/1b2102e996789db8a8c6bc1e71f1798a87731a22 Record club payment source. --- diff --git a/src/club/forms.py b/src/club/forms.py index 5ca08271f..2664fa353 100644 --- a/src/club/forms.py +++ b/src/club/forms.py @@ -20,6 +20,10 @@ class ScheduleForm(forms.ModelForm, NewsletterForm): 'monthly': forms.HiddenInput, } + def __init__(self, referer=None, **kwargs): + self.referer = referer + super().__init__(**kwargs) + def clean_amount(self): value = self.cleaned_data['amount'] club = models.Club.objects.first() @@ -33,6 +37,7 @@ class ScheduleForm(forms.ModelForm, NewsletterForm): def save(self, *args, **kwargs): NewsletterForm.save(self, *args, **kwargs) + self.instance.source = self.referer or '' return super().save(*args, **kwargs) diff --git a/src/club/locale/pl/LC_MESSAGES/django.mo b/src/club/locale/pl/LC_MESSAGES/django.mo index 902a989b0..c0679319f 100644 Binary files a/src/club/locale/pl/LC_MESSAGES/django.mo and b/src/club/locale/pl/LC_MESSAGES/django.mo differ diff --git a/src/club/locale/pl/LC_MESSAGES/django.po b/src/club/locale/pl/LC_MESSAGES/django.po index e56693950..02f756882 100644 --- a/src/club/locale/pl/LC_MESSAGES/django.po +++ b/src/club/locale/pl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2021-01-20 14:34+0100\n" +"PO-Revision-Date: 2021-05-19 15:02+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: pl\n" @@ -31,7 +31,7 @@ msgstr "harmonogram przedawniony" msgid "Club" msgstr "Towarzystwo" -#: club/forms.py:26 +#: club/forms.py:32 #, python-format msgid "Minimal amount is %(amount)d PLN." msgstr "Minimalna kwota to %(amount)d zł." @@ -68,103 +68,107 @@ msgstr "towarzystwo" msgid "clubs" msgstr "towarzystwa" -#: club/models.py:47 +#: club/models.py:48 msgid "key" msgstr "klucz" -#: club/models.py:48 +#: club/models.py:49 msgid "email" msgstr "email" -#: club/models.py:49 club/models.py:155 +#: club/models.py:50 club/models.py:143 msgid "membership" msgstr "członkostwo" -#: club/models.py:50 -msgid "payed at" -msgstr "opłacona" - #: club/models.py:51 -msgid "expires_at" -msgstr "wygasa" - -#: club/models.py:71 msgid "amount" msgstr "kwota" -#: club/models.py:72 club/templates/club/payment_form.html:21 +#: club/models.py:52 club/templates/club/payment_form.html:21 msgid "monthly" msgstr "miesięcznie" -#: club/models.py:73 +#: club/models.py:53 msgid "yearly" msgstr "rocznie" -#: club/models.py:75 +#: club/models.py:55 +msgid "source" +msgstr "źródło" + +#: club/models.py:57 msgid "cancelled" msgstr "anulowany" -#: club/models.py:76 +#: club/models.py:58 +msgid "payed at" +msgstr "opłacona" + +#: club/models.py:59 msgid "started at" msgstr "start" -#: club/models.py:79 +#: club/models.py:60 +msgid "expires_at" +msgstr "wygasa" + +#: club/models.py:64 msgid "schedule" msgstr "harmonogram" -#: club/models.py:80 +#: club/models.py:65 msgid "schedules" msgstr "harmonogramy" -#: club/models.py:147 +#: club/models.py:135 msgid "user" msgstr "użytkownik" -#: club/models.py:148 +#: club/models.py:136 msgid "created at" msgstr "utworzone" -#: club/models.py:149 club/models.py:210 +#: club/models.py:137 club/models.py:198 msgid "name" msgstr "nazwisko" -#: club/models.py:150 +#: club/models.py:138 msgid "manual" msgstr "ustawiony ręcznie" -#: club/models.py:151 +#: club/models.py:139 msgid "notes" msgstr "notatki" -#: club/models.py:152 +#: club/models.py:140 msgid "updated at" msgstr "aktualizacja" -#: club/models.py:156 +#: club/models.py:144 msgid "memberships" msgstr "członkostwa" -#: club/models.py:193 +#: club/models.py:181 msgid "days before" msgstr "dni przed" -#: club/models.py:194 +#: club/models.py:182 msgid "subject" msgstr "temat" -#: club/models.py:195 club/payu/models.py:140 +#: club/models.py:183 club/payu/models.py:140 msgid "body" msgstr "treść" -#: club/models.py:198 +#: club/models.py:186 msgid "reminder email" msgstr "email z przypomnieniem" -#: club/models.py:199 +#: club/models.py:187 msgid "reminder emails" msgstr "emaile z przypomnieniem" -#: club/models.py:204 +#: club/models.py:192 #, python-format msgid "a day before expiration" msgid_plural "%d days before expiration" @@ -173,7 +177,7 @@ msgstr[1] "%d dni przed wygaśnięciem" msgstr[2] "%d dni przed wygaśnięciem" msgstr[3] "%d dni przed wygaśnięciem" -#: club/models.py:206 +#: club/models.py:194 #, python-format msgid "a day after expiration" msgid_plural "%d days after expiration" @@ -182,23 +186,23 @@ msgstr[1] "%d dni po wygaśnięciu" msgstr[2] "%d dni po wygaśnięciu" msgstr[3] "%d dni przed wygaśnięciem" -#: club/models.py:211 +#: club/models.py:199 msgid "photo" msgstr "zdjęcie" -#: club/models.py:212 +#: club/models.py:200 msgid "text" msgstr "tekst" -#: club/models.py:215 +#: club/models.py:203 msgid "ambassador" msgstr "ambasador" -#: club/models.py:216 +#: club/models.py:204 msgid "ambassadors" msgstr "ambasadorowie" -#: club/models.py:247 club/templates/club/index.html:7 +#: club/models.py:235 club/templates/club/index.html:7 #: club/templates/club/index.html:13 club/templates/club/thanks.html:6 #: club/templates/payu/rec_payment.html:5 msgid "Towarzystwo Przyjaciół Wolnych Lektur" @@ -321,11 +325,11 @@ msgstr "Dziękujemy, że chcesz razem z nami uwalniać książki!" msgid "See your past support." msgstr "Zobacz swoje dotychczasowe wsparcie." -#: club/templates/club/membership_form.html:40 +#: club/templates/club/membership_form.html:41 msgid "Help us get 100 new Friends by the end of the school semester." msgstr "Pomóż nam zdobyć 100 nowych Przyjaciół do końca semestru szkolnego." -#: club/templates/club/membership_form.html:41 +#: club/templates/club/membership_form.html:42 #, python-format msgid "" "\n" @@ -354,7 +358,7 @@ msgstr[3] "" "Od początku tej kampanii stałą wpłatą wsparło nas już %(supporters)s czytelników i czytelniczek," -#: club/templates/club/membership_form.html:46 +#: club/templates/club/membership_form.html:47 #, python-format msgid "" "\n" @@ -421,7 +425,7 @@ msgstr "" "\" href=\"https://nowoczesnapolska.org.pl/prywatnosc/\">polityce " "prywatności." -#: club/templates/club/payment_form.html:64 +#: club/templates/club/payment_form.html:65 msgid "Donate" msgstr "Wpłać" diff --git a/src/club/migrations/0026_schedule_source.py b/src/club/migrations/0026_schedule_source.py new file mode 100644 index 000000000..dce415314 --- /dev/null +++ b/src/club/migrations/0026_schedule_source.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.19 on 2021-05-19 10:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('club', '0025_auto_20201126_1250'), + ] + + operations = [ + migrations.AddField( + model_name='schedule', + name='source', + field=models.CharField(blank=True, max_length=255, verbose_name='source'), + ), + ] diff --git a/src/club/models.py b/src/club/models.py index b8ec095c2..babe6f568 100644 --- a/src/club/models.py +++ b/src/club/models.py @@ -51,7 +51,9 @@ class Schedule(models.Model): amount = models.DecimalField(_('amount'), max_digits=10, decimal_places=2) monthly = models.BooleanField(_('monthly'), default=True) yearly = models.BooleanField(_('yearly'), default=False) - + + source = models.CharField(_('source'), max_length=255, blank=True) + is_cancelled = models.BooleanField(_('cancelled'), default=False) payed_at = models.DateTimeField(_('payed at'), null=True, blank=True) started_at = models.DateTimeField(_('started at'), auto_now_add=True) diff --git a/src/club/views.py b/src/club/views.py index e93864cab..6a5c7d725 100644 --- a/src/club/views.py +++ b/src/club/views.py @@ -60,6 +60,11 @@ class JoinView(CreateView): 'email': self.request.user.email, } + def get_form_kwargs(self): + kwargs = super().get_form_kwargs() + kwargs['referer'] = self.request.META.get('HTTP_REFERER', '') + return kwargs + def form_valid(self, form): retval = super(JoinView, self).form_valid(form) if self.request.user.is_authenticated: