Merge branch 'release/v1.8'
This commit is contained in:
20
context_processors.py
Normal file
20
context_processors.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
def google_analytics(request):
|
||||||
|
"""
|
||||||
|
Use the variables returned in this function to
|
||||||
|
render your Google Analytics tracking code template.
|
||||||
|
"""
|
||||||
|
ga_prop_id = getattr(settings, 'GOOGLE_ANALYTICS_PROPERTY_ID', False)
|
||||||
|
ga_domain = getattr(settings, 'GOOGLE_ANALYTICS_DOMAIN', False)
|
||||||
|
if not settings.DEBUG and ga_prop_id and ga_domain:
|
||||||
|
return {
|
||||||
|
'GOOGLE_ANALYTICS_PROPERTY_ID': ga_prop_id,
|
||||||
|
'GOOGLE_ANALYTICS_DOMAIN': ga_domain,
|
||||||
|
}
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def hello_world(request):
|
||||||
|
return {
|
||||||
|
'helloworld': 'hi Sander'
|
||||||
|
}
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
<head>
|
<head>
|
||||||
<script src="/static/cookielaw/js/cookielaw.js"></script>
|
<script src="/static/cookielaw/js/cookielaw.js"></script>
|
||||||
{% analytical_head_top %}
|
{% analytical_head_top %}
|
||||||
|
{% if GOOGLE_ANALYTICS_PROPERTY_ID %}
|
||||||
|
{% include "ga.html" %}
|
||||||
|
{% endif %}
|
||||||
<link rel="stylesheet" href="/static/css/bokeh-0.12.3.min.css" type="text/css" />
|
<link rel="stylesheet" href="/static/css/bokeh-0.12.3.min.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="/static/css/bokeh-widgets-0.12.3.min.css" type="text/css" />
|
<link rel="stylesheet" href="/static/css/bokeh-widgets-0.12.3.min.css" type="text/css" />
|
||||||
|
|
||||||
@@ -52,7 +55,7 @@
|
|||||||
{% if user.rower.rowerplan == 'pro' or user.rower.rowerplan == 'coach' %}
|
{% if user.rower.rowerplan == 'pro' or user.rower.rowerplan == 'coach' %}
|
||||||
<h6>Pro Member</h6>
|
<h6>Pro Member</h6>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p> </p>
|
<div class="grid_2 alpha"><a class="button green small" href="/rowers/promembership">Upgrade to Pro</a></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_1 omega">
|
<div class="grid_1 omega">
|
||||||
|
|||||||
10
rowers/templates/ga.html
Normal file
10
rowers/templates/ga.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', '{{ GOOGLE_ANALYTICS_PROPERTY_ID }}', '{{ GOOGLE_ANALYTICS_DOMAIN }}');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -561,7 +561,10 @@ class ViewTest(TestCase):
|
|||||||
|
|
||||||
response = self.c.get('/rowers/workout/1/', form_data, follow=True)
|
response = self.c.get('/rowers/workout/1/', form_data, follow=True)
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
response = self.c.get('/rowers/workout/1/export', form_data, follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
response = self.c.get('/rowers/workout/1/interactiveplot', form_data, follow=True)
|
response = self.c.get('/rowers/workout/1/interactiveplot', form_data, follow=True)
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
Django settings for rowsandall_app project.
|
Django settings for rowsandall_app project.
|
||||||
|
|
||||||
@@ -103,10 +104,11 @@ TEMPLATES = [
|
|||||||
'context_processors': [
|
'context_processors': [
|
||||||
'django.template.context_processors.debug',
|
'django.template.context_processors.debug',
|
||||||
'django.template.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.core.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
'django.template.context_processors.i18n',
|
'django.template.context_processors.i18n',
|
||||||
|
'context_processors.google_analytics',
|
||||||
],
|
],
|
||||||
# 'loaders': [
|
# 'loaders': [
|
||||||
# 'django.template.loaders.app_directories.Loader',
|
# 'django.template.loaders.app_directories.Loader',
|
||||||
@@ -325,6 +327,9 @@ SWAGGER_SETTINGS = {
|
|||||||
|
|
||||||
CLICKY_SITE_ID = CFG['clicky_site_id']
|
CLICKY_SITE_ID = CFG['clicky_site_id']
|
||||||
|
|
||||||
|
GOOGLE_ANALYTICS_PROPERTY_ID = CFG['google_analytics_id']
|
||||||
|
GOOGLE_ANALYTICS_DOMAIN = CFG['google_analytics_domain']
|
||||||
|
|
||||||
TWEET_ACCESS_TOKEN_KEY = CFG['tweet_access_token_key']
|
TWEET_ACCESS_TOKEN_KEY = CFG['tweet_access_token_key']
|
||||||
TWEET_ACCESS_TOKEN_SECRET = CFG['tweet_access_token_secret']
|
TWEET_ACCESS_TOKEN_SECRET = CFG['tweet_access_token_secret']
|
||||||
TWEET_CONSUMER_KEY = CFG['tweet_consumer_key']
|
TWEET_CONSUMER_KEY = CFG['tweet_consumer_key']
|
||||||
|
|||||||
Reference in New Issue
Block a user