# HG changeset patch # User Branko Majic # Date 2013-03-17 12:32:54 # Node ID 683a733d3e9ca4cca4376b173a91bdf2901e8d73 # Parent c5c40a039ec4482b572968f39dd434aec254e30d Added support to the html_link for passing an additional GET parameter(s). diff --git a/conntrackt/templates/conntrackt/html_link.html b/conntrackt/templates/conntrackt/html_link.html --- a/conntrackt/templates/conntrackt/html_link.html +++ b/conntrackt/templates/conntrackt/html_link.html @@ -1,2 +1,2 @@ {% load url from future %} -{{text}} +{{text}} diff --git a/conntrackt/templatetags/conntrackt.py b/conntrackt/templatetags/conntrackt.py --- a/conntrackt/templatetags/conntrackt.py +++ b/conntrackt/templatetags/conntrackt.py @@ -29,6 +29,8 @@ def html_link(text, view, *args, **kwarg title - Title for the HTML element. + get - Additional GET parameter that should be appended to the URL. + """ # We'll return a context for rendering with the template. Add the text right @@ -42,7 +44,7 @@ def html_link(text, view, *args, **kwarg # Iterate over keyword arguments, and if we support them, just assign them # to the context as is. Raise an exception if a keyword is unsupported. for key, value in kwargs.items(): - if key in ("class", "title", "id"): + if key in ("class", "title", "id", "get"): context[key] = value else: raise template.TemplateSyntaxError("Unknown argument for 'advhtml_link' tag: %r" % key )