Skip to content Skip to sidebar Skip to footer

How To Use Get_context_data In Django

I have Views.py class newChartView(TemplateView): template_name = 'new_report_view.html' def get_context_data(self, **kwargs): context = super(newChartView, self)

Solution 1:

Could you let us know what smslogger.py contains ?

I think you might be need to do something like this.

from smslogger import YourModel

classnewChartView(TemplateView):
    template_name = "new_report_view.html"defget_context_data(self, **kwargs):
        context = super(newChartView, self).get_context_data(**kwargs)
        context['count'] = YourModel.objects.all()
        return context

Post a Comment for "How To Use Get_context_data In Django"