Record club payment source.
authorRadek Czajka <rczajka@rczajka.pl>
Wed, 19 May 2021 13:04:03 +0000 (15:04 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Wed, 19 May 2021 13:04:03 +0000 (15:04 +0200)
src/club/forms.py
src/club/locale/pl/LC_MESSAGES/django.mo
src/club/locale/pl/LC_MESSAGES/django.po
src/club/migrations/0026_schedule_source.py [new file with mode: 0644]
src/club/models.py
src/club/views.py

index 5ca0827..2664fa3 100644 (file)
@@ -20,6 +20,10 @@ class ScheduleForm(forms.ModelForm, NewsletterForm):
             'monthly': forms.HiddenInput,
         }
 
             '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()
     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)
 
     def save(self, *args, **kwargs):
         NewsletterForm.save(self, *args, **kwargs)
+        self.instance.source = self.referer or ''
         return super().save(*args, **kwargs)
 
 
         return super().save(*args, **kwargs)
 
 
index 902a989..c067931 100644 (file)
Binary files a/src/club/locale/pl/LC_MESSAGES/django.mo and b/src/club/locale/pl/LC_MESSAGES/django.mo differ
index e566939..02f7568 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
 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"
 "Last-Translator: \n"
 "Language-Team: \n"
 "Language: pl\n"
@@ -31,7 +31,7 @@ msgstr "harmonogram przedawniony"
 msgid "Club"
 msgstr "Towarzystwo"
 
 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ł."
 #, 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"
 
 msgid "clubs"
 msgstr "towarzystwa"
 
-#: club/models.py:47
+#: club/models.py:48
 msgid "key"
 msgstr "klucz"
 
 msgid "key"
 msgstr "klucz"
 
-#: club/models.py:48
+#: club/models.py:49
 msgid "email"
 msgstr "email"
 
 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"
 
 msgid "membership"
 msgstr "członkostwo"
 
-#: club/models.py:50
-msgid "payed at"
-msgstr "opłacona"
-
 #: club/models.py:51
 #: club/models.py:51
-msgid "expires_at"
-msgstr "wygasa"
-
-#: club/models.py:71
 msgid "amount"
 msgstr "kwota"
 
 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"
 
 msgid "monthly"
 msgstr "miesięcznie"
 
-#: club/models.py:73
+#: club/models.py:53
 msgid "yearly"
 msgstr "rocznie"
 
 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"
 
 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"
 
 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"
 
 msgid "schedule"
 msgstr "harmonogram"
 
-#: club/models.py:80
+#: club/models.py:65
 msgid "schedules"
 msgstr "harmonogramy"
 
 msgid "schedules"
 msgstr "harmonogramy"
 
-#: club/models.py:147
+#: club/models.py:135
 msgid "user"
 msgstr "użytkownik"
 
 msgid "user"
 msgstr "użytkownik"
 
-#: club/models.py:148
+#: club/models.py:136
 msgid "created at"
 msgstr "utworzone"
 
 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"
 
 msgid "name"
 msgstr "nazwisko"
 
-#: club/models.py:150
+#: club/models.py:138
 msgid "manual"
 msgstr "ustawiony ręcznie"
 
 msgid "manual"
 msgstr "ustawiony ręcznie"
 
-#: club/models.py:151
+#: club/models.py:139
 msgid "notes"
 msgstr "notatki"
 
 msgid "notes"
 msgstr "notatki"
 
-#: club/models.py:152
+#: club/models.py:140
 msgid "updated at"
 msgstr "aktualizacja"
 
 msgid "updated at"
 msgstr "aktualizacja"
 
-#: club/models.py:156
+#: club/models.py:144
 msgid "memberships"
 msgstr "członkostwa"
 
 msgid "memberships"
 msgstr "członkostwa"
 
-#: club/models.py:193
+#: club/models.py:181
 msgid "days before"
 msgstr "dni przed"
 
 msgid "days before"
 msgstr "dni przed"
 
-#: club/models.py:194
+#: club/models.py:182
 msgid "subject"
 msgstr "temat"
 
 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ść"
 
 msgid "body"
 msgstr "treść"
 
-#: club/models.py:198
+#: club/models.py:186
 msgid "reminder email"
 msgstr "email z przypomnieniem"
 
 msgid "reminder email"
 msgstr "email z przypomnieniem"
 
-#: club/models.py:199
+#: club/models.py:187
 msgid "reminder emails"
 msgstr "emaile z przypomnieniem"
 
 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"
 #, 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"
 
 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"
 #, 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"
 
 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"
 
 msgid "photo"
 msgstr "zdjęcie"
 
-#: club/models.py:212
+#: club/models.py:200
 msgid "text"
 msgstr "tekst"
 
 msgid "text"
 msgstr "tekst"
 
-#: club/models.py:215
+#: club/models.py:203
 msgid "ambassador"
 msgstr "ambasador"
 
 msgid "ambassador"
 msgstr "ambasador"
 
-#: club/models.py:216
+#: club/models.py:204
 msgid "ambassadors"
 msgstr "ambasadorowie"
 
 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"
 #: 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."
 
 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."
 
 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"
 #, python-format
 msgid ""
 "\n"
@@ -354,7 +358,7 @@ msgstr[3] ""
 "Od początku tej kampanii stałą wpłatą wsparło nas już <b style=\"color: "
 "#0d7e85\">%(supporters)s</b> czytelników i czytelniczek,"
 
 "Od początku tej kampanii stałą wpłatą wsparło nas już <b style=\"color: "
 "#0d7e85\">%(supporters)s</b> czytelników i czytelniczek,"
 
-#: club/templates/club/membership_form.html:46
+#: club/templates/club/membership_form.html:47
 #, python-format
 msgid ""
 "\n"
 #, python-format
 msgid ""
 "\n"
@@ -421,7 +425,7 @@ msgstr ""
 "\" href=\"https://nowoczesnapolska.org.pl/prywatnosc/\">polityce "
 "prywatności</a>."
 
 "\" href=\"https://nowoczesnapolska.org.pl/prywatnosc/\">polityce "
 "prywatności</a>."
 
-#: club/templates/club/payment_form.html:64
+#: club/templates/club/payment_form.html:65
 msgid "Donate"
 msgstr "Wpłać"
 
 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 (file)
index 0000000..dce4153
--- /dev/null
@@ -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'),
+        ),
+    ]
index b8ec095..babe6f5 100644 (file)
@@ -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)
     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)
     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)
index e93864c..6a5c7d7 100644 (file)
@@ -60,6 +60,11 @@ class JoinView(CreateView):
                 'email': self.request.user.email,
             }
 
                 '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:
     def form_valid(self, form):
         retval = super(JoinView, self).form_valid(form)
         if self.request.user.is_authenticated: