from django import template from dss import settings register = template.Library() class ShowGoogleAnalyticsJS(template.Node): def render(self, context): code = getattr(settings, "GOOGLE_ANALYTICS_CODE", False) if not code: return "" if 'user' in context and context['user'] and context['user'].is_staff: return "" if settings.DEBUG: return "" return """"""