self.request.POST in get_context_data

257 views
Skip to first unread message

bnmng

unread,
Nov 17, 2020, 8:54:14 AM11/17/20
to Django users
Hi. 

I can find dozens of examples of people using "if self.request.POST:" inside of get_context_data, but as far as I can tell there is no POST in get_context_data. 

I came across this in an answer in Stack Overflow: 

>> get_context_data() is only run for GET requests (assuming you are using a FormView), and not for POST requests handled by post()
( https://stackoverflow.com/questions/38319384/passing-data-from-post-to-get-context-data )

So I experimented and as far as I can tell you don't even need POST data to populate inline formsets.  So why are so many people under the impression that you can do anything with self.request.POST inside of get_context_data and why do so many people seem to think you have to use POST data to populate inline formsets?


Reply all
Reply to author
Forward
0 new messages