A
A
Alex1612020-12-07 13:19:05
Django
Alex161, 2020-12-07 13:19:05

Tell me please, how can I find out what is passed in the dictionary to the template?

class MovieDetailView(DetailView):
    """Вывод детальной информации о фильме"""
    model = Movie
    template_name = 'movie/movie_detail.html'
    context_object_name = 'movie'

    def get_context_data(self, **kwargs):
        context = super(MovieDetailView, self).get_context_data(**kwargs)
        context['title'] = 'привет'
        return context

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MagaSim, 2020-12-07
@Alex161

In this example, it will be passed, as I understand it, context['title'] = 'hello'. That is, a dictionary of the form will be passed: {'title': 'hello'}
In general, you form the context before passing it to the template.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question