X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/3d95fcd3649e33465314257c8b93ff139b95629f..dce4cbe605cb926b5583f7ddd325704b527e7e5c:/src/club/forms.py?ds=sidebyside 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)