Use GET method instead of POST during submit button #80
Replies: 5 comments 6 replies
-
django-formset always transfers the form(s) payload using encoding type |
Beta Was this translation helpful? Give feedback.
-
Is it possible then to redirect the data from POST method to GET method, as for filtering a certain queryset, GET is the method that is used? |
Beta Was this translation helpful? Give feedback.
-
Was just having a go at implementing this myself because I need the same functionality for a filter view like OP. If you're willing to forgo the use of any df-click actions on the submit button, then you can submit as a GET request using some simple inline javascript. The javascript is required to force form submission because the regular 'submit' event is being prevented by django-formset. So here's my solution for a GET request including URL params:
Not sure if there are any side effects but seems to work fine for me :) |
Beta Was this translation helpful? Give feedback.
-
@SSJenny90 Your solution is, hmm, a bit hacky. However, I get your point. May I ask why in the first place you want to use django-formset to create forms invoked using method="GET"? If it's because you want to have it rendered using the Bootstrap renderer, then I can look for a solution which works for you. |
Beta Was this translation helpful? Give feedback.
-
+1 to this! Using django-filter has become the de facto standard for integrating filtering into Django projects. An additional advantage of using a |
Beta Was this translation helpful? Give feedback.
-
Is it possible to invoked GET method instead of POST when submitting a django-formset form.
I'm creating a filter using django-filterset and rendering the said form in my template using
render_form
tag.But everytime I click the submit button to filter my queryset, I can see that POST method is getting invoked.
template.html
Beta Was this translation helpful? Give feedback.
All reactions