A pager for detail view?

I have a product category ListView when I navigate to a specific directory DetailView
In the directory I load the related goods through product_set.all I need to do pagination for products
Catalog and products 2 different applications but they are connected. The directory includes ideas about the list of categories and one category and the app products is one representation of the product that is DetailView
Code categories
app_name = 'catalog'

mapping includes = [
 path(", CategoriesList.as_view(), name='categories_list'),
 path('<str:slug>/', CategoryDetail.as_view(), name='category_detail'),

class CategoriesList(ListView):
 model = Category
 context_object_name = 'categories'
 template_name = 'catalog/categories_list.html'

class CategoryDetail(DetailView):
 model = Category
 template_name = 'catalog/category_detail.html'

Product code
app_name = 'product'

mapping includes = [

 # Redirect to the directory
 path(", RedirectView.as_view(url='/catalog/')),

 path('<str:slug>/', ProductDetail.as_view(), name='detail'),

class ProductDetail(DetailView):

 model = Product
 template_name = 'products/products_detail.html'

 def get_context_data(self, **kwargs):
 """Add view of the form comment"""

 context = super().get_context_data(**kwargs)
 context['comment_form'] = CommentForm()
 return context

And now the questions
1) it is Better to override the DetailView a directory in the ListView and do the pagination?
1.1), Then the logic in what application should it be in view because this is a list of products and category

2) Make pagination in DetailView, then tell me how to do it, preferably in detail. I watched the answers and code but I can not understand how it works here are the links
- https://stackoverflow.com/questions/25569551/pagin...
- https://gist.github.com/nspo/5ab1ecde7e918a5fa2662...
- https://www.reddit.com/r/django/comments/6tdavj/he...
April 19th 20 at 12:18
1 answer
April 19th 20 at 12:20
1) Yes
1.1) Depends first of all from where where you have the model imported is the most common cause of cyclic imports.
2) you Can use a pager directly, about the same as done in the ListView, just set it to category.product_set.all(). Naturally, all manually.
The model imports of the products in the category - ciel commented on April 19th 20 at 12:23

Find more questions by tags Django