Changeset - 683a733d3e9c
[Not reviewed]
default
0 2 0
Branko Majic (branko) - 11 years ago 2013-03-17 12:32:54
branko@majic.rs
Added support to the html_link for passing an additional GET parameter(s).
2 files changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
conntrackt/templates/conntrackt/html_link.html
Show inline comments
 
{% load url from future %}
 
<a href="{{url}}"{% if title %} title="{{title}}"{% endif %}{% if id %} id="{{id}}"{% endif %}{%if class %} class="{{class}}"{% endif %}>{{text}}</a>
 
<a href="{{url}}{% if get %}?{{get}}{% endif %}"{% if title %} title="{{title}}"{% endif %}{% if id %} id="{{id}}"{% endif %}{%if class %} class="{{class}}"{% endif %}>{{text}}</a>
conntrackt/templatetags/conntrackt.py
Show inline comments
 
@@ -29,6 +29,8 @@ def html_link(text, view, *args, **kwarg
 

	
 
        title - Title for the HTML <a> 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 )
0 comments (0 inline, 0 general)