equal
deleted
inserted
replaced
54 def wrapper(self): |
54 def wrapper(self): |
55 field_content = self.cleaned_data.get(field_name) |
55 field_content = self.cleaned_data.get(field_name) |
56 |
56 |
57 if not field_content: |
57 if not field_content: |
58 # field has no content so bail out |
58 # field has no content so bail out |
59 return field_content |
59 return None |
60 else: |
60 else: |
61 # field has contents |
61 # field has contents |
62 return fun(self) |
62 return fun(self) |
63 return wrapper |
63 return wrapper |
64 |
64 |
233 |
233 |
234 @check_field_is_empty(field_name) |
234 @check_field_is_empty(field_name) |
235 def wrapped(self): |
235 def wrapped(self): |
236 |
236 |
237 value = self.cleaned_data.get(field_name) |
237 value = self.cleaned_data.get(field_name) |
238 |
|
239 # LinkProperty does not accept the empty string so we must return None |
|
240 if not value or value == u'': |
|
241 return None |
|
242 |
238 |
243 # call the Django URLField cleaning method to properly clean/validate this field |
239 # call the Django URLField cleaning method to properly clean/validate this field |
244 return forms.URLField.clean(self.fields[field_name], value) |
240 return forms.URLField.clean(self.fields[field_name], value) |
245 return wrapped |
241 return wrapped |
246 |
242 |