Skip to content
Snippets Groups Projects
Commit 21f003d0 authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

fix timestamp → date

parent e507013c
No related branches found
No related tags found
2 merge requests!901fix timestamp → date,!900Fix timestamp → date
Pipeline #16400 passed
......@@ -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 []
......
......
......@@ -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,
)
......
......
......@@ -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 []
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment