These are chat archives for django/django

9th
Jan 2018
Youcef Bennouar
@youcef-ag
Jan 09 2018 07:45
how to do a pagination with variable 'per_page'. For example, I have 100 articles I wish that the first page (1) contains 3 articles, the second page (2) contains 5 articles, will excite, me who draws of how many articles in each page.
django-pagination.jpg
Anish Shrestha
@annshress
Jan 09 2018 13:16
@youcef-ag do pagination by LimitOffset
@emihir0 you could create your custom Manager maybe?
Roel
@roelzkie15
Jan 09 2018 14:22
is there any roadmap available for django backend developers?
emihir0
@emihir0
Jan 09 2018 17:21
@annshress custom manager is much weaker compared to custom queryset. custom queryset allows for chained expressions, yet does all of manager too
e.g. in queryset you can define def employed(self): return self.filter(employed=True) and then you can do something like Employee.objects.filter(...).employed().filter(...)
which is super convenient