1👍
request.POST.get('extra_field_count')
seems to be the culprit for that error. With the form field extra_field_count
not having an extra field count, it has no value. However, the pointer to a value of None
still exists, and so can be found in the init method of your form, even though it has a value of none.
Consider this example.
>>> mydict = {'a':None}
>>> print mydict.pop('a')
None
request.POST
and kwargs
are dictionaries just like mydict
.
The easiest fix? Check for null values in the __init__
method of your form.
extra_fields = kwargs.pop('extra', 0)
if not extra_fields:
extra_fields = 0
Source:stackexchange.com