From: Clint Ecker Date: Mon, 7 Jul 2008 19:57:16 +0000 (+0000) Subject: If the code is left blank, nothing should be rendered X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=e48d8ce2234f3de7a0dc645eeee15d5ceec083ef;p=django-google-tools.git If the code is left blank, nothing should be rendered --- diff --git a/templatetags/analytics.py b/templatetags/analytics.py index 7ea2b49..05a7df7 100644 --- a/templatetags/analytics.py +++ b/templatetags/analytics.py @@ -38,11 +38,14 @@ class AnalyticsNode(template.Node): code = self.code else: return '' - - t = loader.get_template('google_analytics/analytics_template.html') - c = Context({ - 'analytics_code': code, - }) - return t.render(c) + + if code.strip() != '': + t = loader.get_template('google_analytics/analytics_template.html') + c = Context({ + 'analytics_code': code, + }) + return t.render(c) + else: + return '' register.tag('analytics', do_get_analytics)