]> git.parisson.com Git - telemeta.git/commitdiff
add googletools
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 22 Dec 2014 13:41:19 +0000 (14:41 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 22 Dec 2014 13:41:19 +0000 (14:41 +0100)
example/sandbox/settings.py
setup.py
telemeta/templates/telemeta/base.html
telemeta/templatetags/telemeta_utils.py

index a94da9f237771686949f8fa3ac30ce29d5d1a51e..097d4a715dc9c2597f69700611482cac9669ee10 100644 (file)
@@ -146,6 +146,7 @@ INSTALLED_APPS = (
     'debug_toolbar',
     'bootstrap3',
     'bootstrap_pagination',
+    'googletools',
 )
 
 TEMPLATE_CONTEXT_PROCESSORS = (
index 03fdbfe374887497c96ffc7436e83ef923c0fd4b..c6bc19fa3c294f1defb2f0c3721a2177eec86bdc 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -60,6 +60,7 @@ setup(
         'django-bootstrap-pagination',
         'django-json-rpc==0.6.2',
         'django-suit',
+        'django-google-tools',
         'timeside>=0.5.6',
         'south',
         'sorl-thumbnail',
index 8abc00c8fdfcc2aec60b1b3e8b1f6dbc89032770..f6b4cc36ba01f99e97a4238228646343a7f77cb5 100644 (file)
@@ -1,7 +1,11 @@
 <!DOCTYPE html>
 {% load i18n %}
-{% load telemeta_utils %}{# Load the tag library #}
+{% load telemeta_utils %}
 {% load bootstrap3 %}
+{% if get_googletools %}
+{% load googletools %}
+{% endif %}
+
 {% get_current_language as LANGUAGE_CODE %}
 {% get_available_languages as LANGUAGES %}
 <html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
@@ -10,6 +14,7 @@
 <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
 <meta charset="utf-8" />
 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+
 <link rel="alternate" href="/rss" title="RSS 2.0" type="application/rss+xml" />
 
 <title>{%block head_title %}{% description %} - Telemeta{% endblock %}</title>
 {% endblock layout %}
 
 {% block analytics %}
+{% if googletools %}
+{% site_verification_code %}
+{% analytics_code %}
+{% endif %}
 {% endblock analytics %}
 
 </body>
index 564793f7a78d4996d8bedabc88da34b5a5c191e0..8efadbbf68471bce6f6713f9fd25ccde603c0ee5 100644 (file)
@@ -400,12 +400,9 @@ def mime_to_media_type(mime_type):
     else:
         return 'Audio'
 
-@register.filter
-def installed(app):
-    if app in settings.INSTALLED_APPS:
-        return app
-    else:
-        return ''
+@register.simple_tag
+def is_installed(app):
+    return app in settings.INSTALLED_APPS
 
 def do_ifloaded(parser, token):
     bits = token.split_contents()[1:]
@@ -463,3 +460,7 @@ def logo_url():
     static_url = getattr(settings, 'STATIC_URL', '/static/')
     return getattr(settings, 'TELEMETA_LOGO', static_url + '/telemeta/images/logo_telemeta_2.png')
 
+@register.assignment_tag
+def get_googletools():
+    return 'googletools' in settings.INSTALLED_APPS
+