Code

Opened 7 years ago

Closed 7 years ago

#4936 closed (worksforme)

newforms fails if field name is "data"

Reported by: zeraien@… Owned by: adrian
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:

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

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by Brian Rosner <brosner@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.