Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix product form validation when the parent field is excluded #264

Merged
merged 2 commits into from

2 participants

@fjern

Some projects may want to exclude the parent field from the product update form - need to fix the form validation in this case so that they can call the super clean.

@codeinthehole codeinthehole merged commit d521b2e into releases/0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 31, 2012
  1. @fjern
  2. @fjern

    Fix if conditions

    fjern authored
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 oscar/apps/dashboard/catalogue/forms.py
View
4 oscar/apps/dashboard/catalogue/forms.py
@@ -187,7 +187,9 @@ def save_attributes(self, object):
def clean(self):
data = self.cleaned_data
- if data['parent'] is None and not data['title']:
+ if 'parent' not in data and not data['title']:
+ raise forms.ValidationError(_("This field is required"))
+ elif 'parent' in data and data['parent'] is None and not data['title']:
raise forms.ValidationError(_("Parent products must have a title"))
return data
Something went wrong with that request. Please try again.