Opened 11 years ago

Closed 11 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: UI/UX:


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/" in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "/Users/zeraien/Documents/Development/web/project/../project/customers/" in edit_contact_data
  67. if form.is_valid():
File "/sw/lib/python2.5/site-packages/django/newforms/" in is_valid
  99. return self.is_bound and not bool(self.errors)
File "/sw/lib/python2.5/site-packages/django/newforms/" in _errors
  90. self.full_clean()
File "/sw/lib/python2.5/site-packages/django/newforms/" 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 Changed 11 years ago by Brian Rosner <brosner@…>

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