From 3904d09c49d2335bc7f7e21fdd08b70c3893f4ca Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Thu, 17 Oct 2013 19:11:39 -0300 Subject: [PATCH] moving url template tag to superarchives file --- src/super_archives/templates/message-list.html | 3 +-- src/super_archives/templates/message-thread.html | 2 +- src/super_archives/templatetags/superarchives.py | 20 ++++++++++++++++++++ src/super_archives/templatetags/urlutils.py | 24 ------------------------ src/templates/search/search.html | 4 +--- 5 files changed, 23 insertions(+), 30 deletions(-) delete mode 100644 src/super_archives/templatetags/urlutils.py diff --git a/src/super_archives/templates/message-list.html b/src/super_archives/templates/message-list.html index c089e69..0c7a16c 100644 --- a/src/super_archives/templates/message-list.html +++ b/src/super_archives/templates/message-list.html @@ -1,6 +1,5 @@ {% extends "base.html" %} -{% load i18n %} -{% load append_to_get %} +{% load i18n superarchives %} {% block main-content %}

{% trans "Discussions" %}

diff --git a/src/super_archives/templates/message-thread.html b/src/super_archives/templates/message-thread.html index 79f04b1..fc7cf12 100644 --- a/src/super_archives/templates/message-thread.html +++ b/src/super_archives/templates/message-thread.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load i18n append_to_get gravatar superarchives %} +{% load i18n gravatar superarchives %} {% trans "Anonymous" as anonymous %} diff --git a/src/super_archives/templatetags/superarchives.py b/src/super_archives/templatetags/superarchives.py index a358776..0434633 100644 --- a/src/super_archives/templatetags/superarchives.py +++ b/src/super_archives/templatetags/superarchives.py @@ -1,6 +1,8 @@ from django import template +from super_archives.utils import url + register = template.Library() TEMPLATE_PATH = 'superarchives/tags/' @@ -12,3 +14,21 @@ def display_message(email): email.update_blocks() return { 'blocks': email.blocks.all } + + +@register.simple_tag(takes_context=True) +def append_to_get(context, **kwargs): + return url.append_to_get( + context['request'].META['PATH_INFO'], + context['request'].META['QUERY_STRING'], + **kwargs + ) + + +@register.simple_tag(takes_context=True) +def pop_from_get(context, **kwargs): + return url.pop_from_get( + context['request'].META['PATH_INFO'], + context['request'].META['QUERY_STRING'], + **kwargs + ) diff --git a/src/super_archives/templatetags/urlutils.py b/src/super_archives/templatetags/urlutils.py deleted file mode 100644 index e049ae9..0000000 --- a/src/super_archives/templatetags/urlutils.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -from django import template - -from super_archives.utils import url - -register = template.Library() - - -@register.simple_tag(takes_context=True) -def append_to_get(context, **kwargs): - return url.append_to_get( - context['request'].META['PATH_INFO'], - context['request'].META['QUERY_STRING'], - **kwargs - ) - -@register.simple_tag(takes_context=True) -def pop_from_get(context, **kwargs): - return url.pop_from_get( - context['request'].META['PATH_INFO'], - context['request'].META['QUERY_STRING'], - **kwargs - ) diff --git a/src/templates/search/search.html b/src/templates/search/search.html index 645f77f..a9bc304 100644 --- a/src/templates/search/search.html +++ b/src/templates/search/search.html @@ -1,7 +1,5 @@ {% extends "base.html" %} -{% load i18n %} -{% load urlutils %} -{% load highlight %} +{% load i18n highlight superarchives %} {% block main-content %}
-- libgit2 0.21.2