Opened 17 years ago

Closed 17 years ago

#4936 closed (worksforme)

newforms fails if field name is "data"

Reported by: zeraien@… Owned by: Adrian Holovaty
Component: Forms Version: 0.96
Severity: Keywords: newforms
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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

Change History (1)

comment:1 by Brian Rosner <brosner@…>, 17 years ago

Resolution: worksforme
Status: newclosed

This has since been resolved as of [5237] and for this exact reason. Consider updated your Django sources.

Note: See TracTickets for help on using tickets.
Back to Top