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..a1d77d0 --- /dev/null +++ b/db/base/templatetags/tags.py @@ -0,0 +1,24 @@ +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 + + +@register.filter +def frq(value): + try: + to_format = float(value) + except TypeError: + return '-' + formatted = format(float(to_format) / 1000000, '.3f') + formatted = formatted + ' Mhz' + return formatted 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' diff --git a/db/static/css/app.css b/db/static/css/app.css index e546180..435e714 100644 --- a/db/static/css/app.css +++ b/db/static/css/app.css @@ -178,9 +178,14 @@ footer { .stage-notice { background-color: #D74545; color: white; - padding: 10px; + padding: 5px; text-align: center; font-size: 0.9em; + z-index: 20; + width: 100%; + position: fixed; + top: 0px; + left: 0px; } .stage-notice a { 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 @@ @@ -114,19 +116,19 @@
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
diff --git a/db/templates/includes/stage_notice.html b/db/templates/includes/stage_notice.html index 33c4d8b..753800b 100644 --- a/db/templates/includes/stage_notice.html +++ b/db/templates/includes/stage_notice.html @@ -1,3 +1,9 @@ + +
This is the stage enviroment. Feel free to test it and report bugs.