[Fixed]-Django generic views:displaying records from database

1👍

You’ve defined it as a method rather than a class

def facilities_list(ListView):

should be

class facilities_list(ListView):
👤Sayse

0👍

ListView is imported in Django Class based Views, and it can be done in given way:

class FacilitiesListView(ListView):
      model = Facilities
      queryset = Facilities.objects.all()

Use Django Class Based Views for imported any of Django Genenic class based Views.

Also define a template name or use default template name for it which is facilities_list.html in you facilities template folder.

Leave a comment