thomst / django-admin-csvexport

A django-admin-action to export models as csv
BSD 3-Clause "New" or "Revised" License
17 stars 9 forks source link

Number of output records is restricted implicitly by the Django option #3

Open nnseva opened 3 years ago

nnseva commented 3 years ago

The Django option settings.DATA_UPLOAD_MAX_NUMBER_FIELDS restricts the max number of output records implicitly because the export form contains every record ID in a separate POST field. When the output records number exceeds this value the request fails with code 400.

As a temporary workaround, the settings.DATA_UPLOAD_MAX_NUMBER_FIELDS may be assigned to None to avoid this restriction.

Probably this issue may be resolved in a package using one POST field to store all output record IDs instead of separate fields, as other Django actions do. Then the Django option may be left unchanged. Such a change will also lead to a more compact page.

thomst commented 3 years ago

Unfortunatly there is no easy solution for this issue. As we plug in into the logic of django admin action we need to pass the item ids in seperated fields named _selected_action. They will be collected in request.POST['_selected_action'] as a list of ids. And that is the format the admin action routines expect them to be. I do not know of any way to pass the ids in one input field but let them be a list of ids on the other end in the POST dictonary.

@nnseva : If you have any ideas how to achieve this feel free to try them.