From 50daf33d080c9fa85bf10e98b975cc44f6f72314 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 30 Sep 2012 13:00:41 -0500 Subject: pkg_details_link template tag enhancements * Output the blank string when passed None for pkg argument * Allow override of the link text if optional argument passed Signed-off-by: Dan McGee --- packages/templatetags/package_extras.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py index d87a74a..994265d 100644 --- a/packages/templatetags/package_extras.py +++ b/packages/templatetags/package_extras.py @@ -61,9 +61,13 @@ def do_buildsortqs(parser, token): @register.simple_tag -def pkg_details_link(pkg): +def pkg_details_link(pkg, link_title=None): + if not pkg: + return '' + if link_title is None: + link_title = pkg.pkgname link = '%s' - return link % (pkg.get_absolute_url(), pkg.pkgname, pkg.pkgname) + return link % (pkg.get_absolute_url(), pkg.pkgname, link_title) @register.simple_tag -- cgit v1.2.3-24-g4f1b