mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
Event search: first version
This commit is contained in:
@@ -7,6 +7,8 @@ register = template.Library()
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def add_to_qs(context, **kwargs):
|
||||
"""add kwargs to query string"""
|
||||
|
||||
if 'request' not in context:
|
||||
# "should not happen", because this tag is only assumed to be used in RequestContext templates, but it's not
|
||||
# something I want to break for. Also: we have an answer that "mostly works" for that case, so let's do that.
|
||||
@@ -15,3 +17,16 @@ def add_to_qs(context, **kwargs):
|
||||
query = copy(context['request'].GET.dict())
|
||||
query.update(kwargs)
|
||||
return urlencode(query)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def current_qs(context):
|
||||
if 'request' not in context:
|
||||
# "should not happen", because this tag is only assumed to be used in RequestContext templates, but it's not
|
||||
# something I want to break for. Also: we have an answer that "mostly works" for that case, so let's do that.
|
||||
return ""
|
||||
|
||||
query = copy(context['request'].GET.dict())
|
||||
if query:
|
||||
return '?' + urlencode(query)
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user