[Answered ]-Get error or an empty value while trying for passing id from django template to reactjs

2👍

You’re missing a fundamental piece: TemplateView has no concept of object_list, you have to populate it yourself. If your view is simple enough use ListView and set your model property. If not, you have to manually populate the object list, something like this:

def get_context_data(self, **kwargs):
    context['object_list'] = MyModel.objects.all()

That was just an example to set you on the right path.

👤Ali

Leave a comment