GET parameters seem to always return empty when attempting to retrieve them from the action view. For example when I add the parameter 'form1' to the url that maps to my action http://localhost:8000/admin/form_builder/formdefinition/actions/export_form?form_name=form1
and perform a GET request, the parameter is removed when I access the request.GET object in the action view. Is it possible to access GET parameters somehow?
@admin.register(FormDefinition)
class FormDefinitionAdmin(DjangoObjectActions, BaseAdmin):
changelist_actions = ('export_forms')
def export_forms(self, request, queryset):
# returns empty here
form_name = request.GET.get('form_name')
exporter = FormExporter()
file_path = exporter.export_form(form_name)
with open(file_path, 'r') as file:
response = HttpResponse(file, content_type='application/pdf')
response["Content-Disposition"] = "attachment; filename=forms.json"
return response