1👍
✅
You override get_context_data
and get the value returned by the super method, yet you define a new dictionary and return that. Instead you want to add your extra context to the dictionary returned by the super method:
class UserDetailView(DetailView):
model = User
def get_context_data(self, **kwargs):
context = super(UserDetailView, self).get_context_data(**kwargs)
id = int(self.kwargs.get('pk'))
props = Statistics.objects.filter(user=id, property=100)
context['user_property'] = props
# OR
# context.update({'user_property':props})
return context
Source:stackexchange.com