From b3e404f6fb221cfe5e6e5d826c92f7dc71ec9aae Mon Sep 17 00:00:00 2001 From: Nikos Roussos Date: Sat, 11 Jul 2015 21:25:16 +0300 Subject: [PATCH 1/4] Add active template tag --- db/base/templatetags/__init__.py | 0 db/base/templatetags/tags.py | 14 ++++++++++++++ db/templates/base.html | 7 ++++--- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 db/base/templatetags/__init__.py create mode 100644 db/base/templatetags/tags.py diff --git a/db/base/templatetags/__init__.py b/db/base/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/db/base/templatetags/tags.py b/db/base/templatetags/tags.py new file mode 100644 index 0000000..dcde33d --- /dev/null +++ b/db/base/templatetags/tags.py @@ -0,0 +1,14 @@ +import re + +from django import template +from django.core.urlresolvers import reverse + +register = template.Library() + + +@register.simple_tag +def active(request, urls): + if request.path in ( reverse(url) for url in urls.split() ): + return 'active' + return None + diff --git a/db/templates/base.html b/db/templates/base.html index 25d2347..aefc0ad 100644 --- a/db/templates/base.html +++ b/db/templates/base.html @@ -1,4 +1,5 @@ {% load staticfiles %} +{% load tags %} @@ -36,9 +37,9 @@
Uplink Low
- +
Uplink High
- +
Downlink Low
- +
Downlink High
- +
Mode
@@ -143,7 +145,7 @@
Baud Rate
- +
Citation URL
@@ -200,19 +202,19 @@
Uplink_Low
- +
Uplink High
- +
Downlink Low
- +
Downlink High
- +
Mode
@@ -229,7 +231,7 @@
Baud Rate
- +
Citation URL
From 49918cff1f32a093d363b2159daf2ce13a85b4c2 Mon Sep 17 00:00:00 2001 From: Nikos Roussos Date: Sat, 11 Jul 2015 21:25:46 +0300 Subject: [PATCH 4/4] Fix ALLOWED_HOSTS setting --- db/settings/production.py | 4 +++- db/settings/stage.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/db/settings/production.py b/db/settings/production.py index 0a4a4e6..409849e 100644 --- a/db/settings/production.py +++ b/db/settings/production.py @@ -8,7 +8,9 @@ SECURE_HSTS_SECONDS = 60 SECURE_HSTS_INCLUDE_SUBDOMAINS = True SECURE_CONTENT_TYPE_NOSNIFF = True SECURE_BROWSER_XSS_FILTER = True -ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '*') +ALLOWED_HOSTS = [ + os.getenv('ALLOWED_HOSTS', '*') +] # Email EMAIL_HOST = 'localhost' diff --git a/db/settings/stage.py b/db/settings/stage.py index 85f11b2..6d0c32e 100644 --- a/db/settings/stage.py +++ b/db/settings/stage.py @@ -4,7 +4,9 @@ from base import * ENVIRONMENT = 'stage' # Security -ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '*') +ALLOWED_HOSTS = [ + os.getenv('ALLOWED_HOSTS', '*') +] # Mail EMAIL_HOST = 'localhost'