Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I imagine something like this is possible in Django, but I don't know how to implement it:

I have a TableView, which has filters to filter the displayed queryset. I, then, have a DetailView which you can access from the TableView, to see the details of each element in the queryset.

The DetailView has a form, which uses the POST method. I can successfully send the form, and redirect to the TableView after the POST call. My question is, how can I make it so that after the user calls the POST method in the DetailView, and it redirects again to the TableView, the TableView keeps whichever values were on its filters?

I imagine I would have to either get access to the full request on the TableView (because it includes the ?param1=?param2= etc.), or be able to send the values in the filters when I call the DetailView.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.4k views
Welcome To Ask or Share your Answers For Others

1 Answer

I believe the POST data is stored in request.data. This should be stored in a dictionary so you could iterate through request.data with a for loop to extract the posted data into variables. Then you can do whatever with those variables.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share
...