summaryrefslogtreecommitdiff
path: root/todolists
diff options
context:
space:
mode:
Diffstat (limited to 'todolists')
-rw-r--r--todolists/templatetags/__init__.py0
-rw-r--r--todolists/templatetags/todolists.py19
2 files changed, 19 insertions, 0 deletions
diff --git a/todolists/templatetags/__init__.py b/todolists/templatetags/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/todolists/templatetags/__init__.py
diff --git a/todolists/templatetags/todolists.py b/todolists/templatetags/todolists.py
new file mode 100644
index 00000000..5f31dc1f
--- /dev/null
+++ b/todolists/templatetags/todolists.py
@@ -0,0 +1,19 @@
+from django import template
+
+register = template.Library()
+
+
+def pkg_absolute_url(repo, arch, pkgname):
+ return '/packages/%s/%s/%s/' % (repo.name.lower(), arch.name, pkgname)
+
+
+@register.simple_tag
+def todopkg_details_link(todopkg):
+ pkg = todopkg.pkg
+ if not pkg:
+ return todopkg.pkgname
+ link = '<a href="%s" title="View package details for %s">%s</a>'
+ url = pkg_absolute_url(todopkg.repo, todopkg.arch, pkg.pkgname)
+ return link % (url, pkg.pkgname, pkg.pkgname)
+
+# vim: set ts=4 sw=4 et: