What is the difference between Context, Request Context in django? Why do we need context processors?
RequestContext
simply goes through your TEMPLATE_CONTEXT_PROCESSORS
setting and adds variables in addition to the ones you explicitly pass to the context class.
The context processors are literally just a function that accepts request
as the first argument and returns a dictionary to be added into the context.
Why do you need them? Because some very common operations like adding the currently logged in user or STATIC_URL
variables to the context would get highly repetitive if not automated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With