Skip to content

Instantly share code, notes, and snippets.

@katiayn
Created January 23, 2017 22:08
Show Gist options
  • Save katiayn/25c21ee88765a2a2bb981324834cfe12 to your computer and use it in GitHub Desktop.
Save katiayn/25c21ee88765a2a2bb981324834cfe12 to your computer and use it in GitHub Desktop.
def form_valid(self, form):
self.instance = form.save(commit=False)
object = self.get_object()
if self.instance.is_biscuit and self.instance.is_coated_in_chocolate:
object.set_vat_20()
return super().form_valid(form)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment