joshuakarjala/django-hunger — Issue #8: Form validation via ajax.
Author: hsparikh
Created: 2012-03-03 16:00:58+00:00
State: open

I can't seem to stop coming up with issues, but I hope this one too will be helpful down the line.

I have been trying to implement the standard form validation in hunger if the form is submitted via an ajax request, but I get an arcane error as such:

AttributeError at /

'bool' object has no attribute 'get'

The traceback is quite long, but it seems to germinate from here:

C:\Python27\lib\site-packages\django\forms\forms.py in _clean_fields

del self.cleaned_data

def _clean_fields(self):

for name, field in self.fields.items():

# value_from_datadict() gets the data from the data dictionaries.

# Each widget type knows how to retrieve its own data, because some

# widgets split data over several HTML fields.

value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name))

...

try:

if isinstance(field, FileField):

initial = self.initial.get(name, field.initial)

value = field.clean(value, initial)

else:

value = field.clean(value)