fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Add first alerts.
[redakcja.git]
/
src
/
alerts
/
templatetags
/
alerts.py
diff --git a/src/alerts/templatetags/alerts.py
b/src/alerts/templatetags/alerts.py
new file mode 100644
(file)
index 0000000..
cbab9de
--- /dev/null
+++ b/
src/alerts/templatetags/alerts.py
@@ -0,0
+1,12
@@
+from django.template import Library
+from ..models import Alert
+
+
+register = Library()
+
+@register.simple_tag
+def get_alerts():
+ return {
+ 'count': Alert.objects.all().count(),
+ 'items': Alert.objects.all()[:20],
+ }