Django DetailView – how to use ‘request’ in get_context_data

You have access to the request in self.request – the third paragraph here explains a little more.

EDIT: The text referred to, in case it changes:

The key part to making this work is that when class-based views are called, various useful things are stored on self; as well as the request (self.request) this includes the positional (self.args) and name-based (self.kwargs) arguments captured according to the URLconf.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)