diff --git a/district/models.py b/district/models.py index 1d638815bcc4c59cfe005742658c35cd5a05b062..3ad5df291f9860084409524e7a8aa3416e9031d8 100644 --- a/district/models.py +++ b/district/models.py @@ -495,7 +495,7 @@ class DistrictArticlePage( self.get_siblings(inclusive=False) .live() # TODO? filtrovat na stejné tagy? nebo sdílené články? .specific() - .order_by("-districtarticlepage__date")[:3] + .order_by("-districtarticlepage__timestamp")[:3] ) if self.shared_from is None else [] diff --git a/shared/models/main.py b/shared/models/main.py index 78f2c2ca08b578dc42e35f8a17b94e8672b6baa1..891d84d8fefcaf11e63f1f0716f4f2568b8f4991 100644 --- a/shared/models/main.py +++ b/shared/models/main.py @@ -780,15 +780,15 @@ class MainSearchPageMixin( results = model.objects.filter(filter) - if hasattr(model, "date"): - results = results.order_by("-date") + if hasattr(model, "timestamp"): + results = results.order_by("-timestamp") context["results"] += list(results.all()[:15]) context["results"].sort( - # Put results without a date first, as they'll be person litsings etc. - key=lambda result: result.date - if hasattr(result, "date") + # Put results without a timestamp first, as they'll be person litsings etc. + key=lambda result: result.timestamp + if hasattr(result, "timestamp") else datetime.date(year=9999, month=1, day=1), reverse=True, ) diff --git a/uniweb/models.py b/uniweb/models.py index 0b6217c19d3689d9dd35492c732fa37f547254c4..c5705f21efecbdab51e08d60b3eff1f22e3b61f7 100644 --- a/uniweb/models.py +++ b/uniweb/models.py @@ -631,7 +631,7 @@ class UniwebArticlePage( self.get_siblings(inclusive=False) .live() .specific() - .order_by("-uniwebarticlepage__date")[:3] + .order_by("-uniwebarticlepage__timestamp")[:3] ) if self.shared_from is None else []