fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
beac9fe
)
Freshest alerts first.
author
Radek Czajka
<rczajka@rczajka.pl>
Mon, 23 May 2022 10:12:16 +0000
(12:12 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Mon, 23 May 2022 10:12:16 +0000
(12:12 +0200)
src/alerts/templatetags/alerts.py
patch
|
blob
|
history
diff --git
a/src/alerts/templatetags/alerts.py
b/src/alerts/templatetags/alerts.py
index
cbab9de
..
e443217
100644
(file)
--- a/
src/alerts/templatetags/alerts.py
+++ b/
src/alerts/templatetags/alerts.py
@@
-1,4
+1,5
@@
from django.template import Library
from django.template import Library
+from django.db.models import Max
from ..models import Alert
from ..models import Alert
@@
-8,5
+9,7
@@
register = Library()
def get_alerts():
return {
'count': Alert.objects.all().count(),
def get_alerts():
return {
'count': Alert.objects.all().count(),
- 'items': Alert.objects.all()[:20],
+ 'items': Alert.objects.all().annotate(
+ m=Max('book__chunk__head__created_at')
+ ).order_by('-m')[:20],
}
}