[Solved] Django, views, when I import the model it won’t take the method “objects”


Fix in the index method

list is the reserved keyword in Python. So, just rename it.

def index(request):
   thelist = Donor.objects.all()  #The word objects gets highlighted bc it is not accepted as method
   return render(request, 'home.html', {'lista':thelist})

solved Django, views, when I import the model it won’t take the method “objects”