I have been building a CSV export using Python/Django. While sending all items listed in the change list everything works like a charm.
Now, I've been trying to use Action dropdown and export only those items selected via the checkboxes, but I cannot make it work.
My current code, the one that works even with the Action dropdown yet exporting ALL items, regardless of what was checked:
def export_this_list(self, request, queryset):
"""Generates participants list in Excel sheet."""
csv_elements = Enrolment.objects.all().order_by('-training__date')
for elem in csv_elements:
When csv_elements is swapped with request.POST.getlist obviously nothing works.
def export_this_list(self, request, queryset):
"""Generates participants list in Excel sheet."""
csv_elements = request.POST.getlist('_selected_action')
or
csv_elements = []
for o in request.POST.getlist('_selected_action'):
Question: what is the syntax to combine my Model with the POST action?
Aucun commentaire:
Enregistrer un commentaire