Commit 3904d09c49d2335bc7f7e21fdd08b70c3893f4ca
1 parent
06acd010
Exists in
master
and in
39 other branches
moving url template tag to superarchives file
Showing
5 changed files
with
23 additions
and
30 deletions
Show diff stats
src/super_archives/templates/message-list.html
src/super_archives/templates/message-thread.html
src/super_archives/templatetags/superarchives.py
| 1 | 1 | |
| 2 | 2 | from django import template |
| 3 | 3 | |
| 4 | +from super_archives.utils import url | |
| 5 | + | |
| 4 | 6 | |
| 5 | 7 | register = template.Library() |
| 6 | 8 | TEMPLATE_PATH = 'superarchives/tags/' |
| ... | ... | @@ -12,3 +14,21 @@ def display_message(email): |
| 12 | 14 | email.update_blocks() |
| 13 | 15 | |
| 14 | 16 | return { 'blocks': email.blocks.all } |
| 17 | + | |
| 18 | + | |
| 19 | +@register.simple_tag(takes_context=True) | |
| 20 | +def append_to_get(context, **kwargs): | |
| 21 | + return url.append_to_get( | |
| 22 | + context['request'].META['PATH_INFO'], | |
| 23 | + context['request'].META['QUERY_STRING'], | |
| 24 | + **kwargs | |
| 25 | + ) | |
| 26 | + | |
| 27 | + | |
| 28 | +@register.simple_tag(takes_context=True) | |
| 29 | +def pop_from_get(context, **kwargs): | |
| 30 | + return url.pop_from_get( | |
| 31 | + context['request'].META['PATH_INFO'], | |
| 32 | + context['request'].META['QUERY_STRING'], | |
| 33 | + **kwargs | |
| 34 | + ) | ... | ... |
src/super_archives/templatetags/urlutils.py
| ... | ... | @@ -1,24 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | - | |
| 3 | -from django import template | |
| 4 | - | |
| 5 | -from super_archives.utils import url | |
| 6 | - | |
| 7 | -register = template.Library() | |
| 8 | - | |
| 9 | - | |
| 10 | -@register.simple_tag(takes_context=True) | |
| 11 | -def append_to_get(context, **kwargs): | |
| 12 | - return url.append_to_get( | |
| 13 | - context['request'].META['PATH_INFO'], | |
| 14 | - context['request'].META['QUERY_STRING'], | |
| 15 | - **kwargs | |
| 16 | - ) | |
| 17 | - | |
| 18 | -@register.simple_tag(takes_context=True) | |
| 19 | -def pop_from_get(context, **kwargs): | |
| 20 | - return url.pop_from_get( | |
| 21 | - context['request'].META['PATH_INFO'], | |
| 22 | - context['request'].META['QUERY_STRING'], | |
| 23 | - **kwargs | |
| 24 | - ) |