121👍
as django’s doc says, the value of DATA_UPLOAD_MAX_NUMBER_FIELDS is default 1000, so once your form contains more fields than that number you will get the TooManyFields error.
check out here: https://docs.djangoproject.com/en/stable/ref/settings/
so the solution is simple I think, if DATA_UPLOAD_MAX_NUMBER_FIELDS exists if your settings.py, change it’s value to a higher one, or, if it doesn’t, add it to settings.py:
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10240 # higher than the count of fields
19👍
This happened when I tried posting a huge list values to Backend. In my case I had the liberty of sending the list as a string, and it worked. Django by default has this check to prevent Suspicious activity(SuspiciousOperation
).
However below setting will also work.
# to disable the check
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
You can set this to None to disable the check. Applications that are expected to receive an unusually large number of form fields should tune this setting.
From Django official documentation. https://docs.djangoproject.com/en/3.1/ref/settings/#data-upload-max-number-fields
- [Django]-Running django tutorial tests fail – No module named polls.tests
- [Django]-Do we need to upload virtual env on github too?
- [Django]-How to drop all tables from the database with manage.py CLI in Django?