Last active
May 12, 2017 08:57
-
-
Save katiayn/c3e7b612d43b641314e93df31ae69d36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProductQuestionnaireForm(forms.ModelForm): | |
class Meta: | |
model = ProductQuestionnaire | |
exclude = ( | |
'id', | |
'product', | |
) | |
def save(self, commit=True): | |
instance = super().save(commit) | |
is_biscuit = self.cleaned_data.get('is_biscuit') | |
is_coated_in_chocolate = self.cleaned_data.get('is_coated_in_chocolate') | |
if is_biscuit and is_coated_in_chocolate: | |
instance.product.set_vat_20() | |
return instance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment