dimanche 2 juillet 2017

Django. Make a many-page showcase

StackOverflow, I want to make a many-page showcase.

On the first page, it`ll be first 25 items, in the second - from 26 to 50 and so on.

But how can I do this?

here is urls.py:

products = Product.objects.order_by('-date')
urlpatterns = [
url(r' regexp ', ListView.as_view(queryset=products, template_name='shop/shop.html')),]

It must to asnwer the requests like this: mysite.com/shop/2

and also display products[25*(request_number-1) : 25*request_number] items on page

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire