Browse Source

Merge pull request #264 from tangentlabs/product-form-no-parent-validation

Fix product form validation when the parent field is excluded
master
David Winterbottom 13 years ago
parent
commit
d521b2e4be
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      oscar/apps/dashboard/catalogue/forms.py

+ 3
- 1
oscar/apps/dashboard/catalogue/forms.py View File

@@ -187,7 +187,9 @@ class ProductForm(forms.ModelForm):
187 187
 
188 188
     def clean(self):
189 189
         data = self.cleaned_data
190
-        if data['parent'] is None and not data['title']:
190
+        if 'parent' not in data and not data['title']:
191
+            raise forms.ValidationError(_("This field is required"))
192
+        elif 'parent' in data and data['parent'] is None and not data['title']:
191 193
             raise forms.ValidationError(_("Parent products must have a title"))
192 194
         return data
193 195
 

Loading…
Cancel
Save