1👍
✅
You don’t have to pass the title to the context because it is already there.
In the template, you can access it with {{ object.title }}
Or
for some reason if you still wanted to override get_context_data
, then you can use self.object.title
,
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['title'] = self.object.title
return context
and in templates {{ title }}
Source:stackexchange.com