Answer the question
In order to leave comments, you need to log in
How does get_context_data work in Django?
I'm new to Django and recently learned about the ListView and DetailView classes, the documentation talked about adding extra data to the passed context. I didn’t understand from whom context is inherited in get_context_data and why this function is called with the transfer of a dictionary, it looks like this for me
def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
#context['title'] = 'Название страницы'
return context
Answer the question
In order to leave comments, you need to log in
I did not understand from whom context is inherited in get_context_data
and why is this function called with a dictionary passed,
It was also described in the documentation with the DetailView class, but it also works with the ListView class, then what is the difference between these classes
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question