From: Radek Czajka Date: Wed, 26 Jun 2013 08:54:31 +0000 (+0200) Subject: Set perks on form save. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/11cf55cf2859a23edd2d1dba56e574d01cacce4f?ds=sidebyside;hp=-c Set perks on form save. --- 11cf55cf2859a23edd2d1dba56e574d01cacce4f diff --git a/apps/funding/forms.py b/apps/funding/forms.py index f566e8ef9..165c64d8f 100644 --- a/apps/funding/forms.py +++ b/apps/funding/forms.py @@ -31,10 +31,12 @@ class FundingForm(forms.Form): return self.cleaned_data def save(self): - return Funding.objects.create( + funding = Funding.objects.create( offer=self.offer, name=self.cleaned_data['name'], email=self.cleaned_data['email'], amount=self.cleaned_data['amount'], ) + funding.perks = funding.offer.get_perks(funding.amount) + return funding