'Django pagination in ListView raise Error "Slice"
i want display pagination on my page but i noticed that when i add "paginate_by" raise me error "slice"
class BookNotLogged(generic.ListView):
template_name="BookNotLogged.html"
context_object_name='listofBook'
paginate_by = 2 #when i add this its raise me error
model = Book
queryset = Book.objects.all()
def get_queryset(self):
context={
'book1':Book.objects.get(id="2"),
'book2':Book.objects.get(id="3"),
'book3':Book.objects.get(id="4"),
'book4':Book.objects.get(id="8"),
'book5':Book.objects.get(id="9"),
'book6':Book.objects.get(id="10"),
'book7':Book.objects.get(id="11"),
'book8':Book.objects.get(id="12"),
'book9':Book.objects.get(id="13")
}
return context
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
