add form validation of donation restriction

pull/46/head
eric 2017-12-15 14:04:32 -05:00
parent 4d398fb419
commit af2034da77
1 changed files with 4 additions and 0 deletions

View File

@ -436,6 +436,10 @@ class CampaignPledgeForm(forms.Form):
elif preapproval_amount < self.premium.amount:
logger.info("raising form validating error")
raise forms.ValidationError(_("Sorry, you must pledge at least $%s to select that premium." % (self.premium.amount)))
donation = self.cleaned_data.get('donation', False)
if donation and self.premium.amount > 0:
raise forms.ValidationError(_("Sorry, donations are not eligible for premiums."))
return self.cleaned_data
class TokenCCMixin(forms.Form):