X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/575e58df64c98b53edca9fb6a29b284dbc375609..357027375ff8867f42ca34bcbfb5a78b5b185fc3:/apps/funding/forms.py diff --git a/apps/funding/forms.py b/apps/funding/forms.py deleted file mode 100755 index eb75fb6f1..000000000 --- a/apps/funding/forms.py +++ /dev/null @@ -1,30 +0,0 @@ -from django import forms -from .models import Offer - - -class DummyForm(forms.Form): - amount = forms.DecimalField() - name = forms.CharField() - email = forms.EmailField() - - def __init__(self, offer, *args, **kwargs): - self.offer = offer - super(DummyForm, self).__init__(*args, **kwargs) - - def clean_amount(self): - if self.cleaned_data['amount'] <= 0: - raise forms.ValidationError("A!") - return self.cleaned_data['amount'] - - def clean(self): - if self.offer != Offer.current(): - raise forms.ValidationError("B!") - return self.cleaned_data - - def save(self): - print self.cleaned_data - return self.offer.fund( - name=self.cleaned_data['name'], - email=self.cleaned_data['email'], - amount=self.cleaned_data['amount']) -