Similar to #7, it'd be nice if regardless of the order of the object_list, that there was two properties for the min and max date of a paginator.
There's already a bunch of duplicated logic in the paginator methods dealing with this anyway, should be consolidated.
|
if isinstance(self.object_list, QuerySet): # type: ignore[misc] |
|
first_obj = self.object_list.first() |
|
last_obj = self.object_list.last() |
|
else: |
|
first_obj = self.object_list[0] |
|
last_obj = self.object_list[-1] |
|
|
|
first_date = getattr(first_obj, self.date_field) |
|
last_date = getattr(last_obj, self.date_field) |
|
if isinstance(self.object_list, QuerySet): # type: ignore[misc] |
|
first_obj = self.object_list.first() |
|
last_obj = self.object_list.last() |
|
else: |
|
first_obj = self.object_list[0] |
|
last_obj = self.object_list[-1] |
|
|
|
first_date = getattr(first_obj, self.date_field) |
|
last_date = getattr(last_obj, self.date_field) |
Similar to #7, it'd be nice if regardless of the order of the
object_list, that there was two properties for the min and max date of a paginator.There's already a bunch of duplicated logic in the paginator methods dealing with this anyway, should be consolidated.
django-twc-toolbox/src/django_twc_toolbox/paginator.py
Lines 45 to 53 in 7fb68cb
django-twc-toolbox/src/django_twc_toolbox/paginator.py
Lines 170 to 178 in 7fb68cb