1👍
✅
You need to put the ‘self’ param first in the method.
Why you print dta?
Try this more simple:
from django.shortcuts import render
class GetUsresList(View):
template_name = 'users_details.html'
def get(self, request):
dta = db.user_details.find({},{'userName':1,'mobileNumber':1,'emailId':1,'_id':0})
return render(request, self.template_name, {'dta': dta })
Have you look at the built-in ListView?
Source:stackexchange.com