newforms fails if field name is "data"
|Reported by:||zeraien@…||Owned by:||adrian|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
newforms fails when trying to validate a form where a field is named data. If this is a feature, it should be better documented.
If this is not a feature, then here is the reason for the bug:
Internally newforms stores form data in a variable called clean_data and data, you can not have a field called data in your form.
This is a problem since I find that the name data is useful for several types of fields ;)
The problem should easily be solvable if clean_data (and data) are renamed to clean_form_data or something like that.
Traceback (most recent call last): File "/sw/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response 77. response = callback(request, *callback_args, **callback_kwargs) File "/Users/zeraien/Documents/Development/web/project/../project/customers/views.py" in edit_contact_data 67. if form.is_valid(): File "/sw/lib/python2.5/site-packages/django/newforms/forms.py" in is_valid 99. return self.is_bound and not bool(self.errors) File "/sw/lib/python2.5/site-packages/django/newforms/forms.py" in _errors 90. self.full_clean() File "/sw/lib/python2.5/site-packages/django/newforms/forms.py" in full_clean 180. value = getattr(self, 'clean_%s' % name)() TypeError at /customer/contact/data/1/edit/ 'dict' object is not callable