Add product info to settings file

This commit is contained in:
Robert Einsle 2018-02-10 16:16:14 +01:00
parent a0ecf70986
commit 010ad6ef4f
4 changed files with 13 additions and 5 deletions

View File

@ -1,4 +1,5 @@
from django import template from django import template
from django.conf import settings
register = template.Library() register = template.Library()
@ -17,3 +18,8 @@ def input_class(bound_field):
elif field_type(bound_field) != 'PasswordInput': elif field_type(bound_field) != 'PasswordInput':
css_class = 'is-valid' css_class = 'is-valid'
return 'form-control {}'.format(css_class) return 'form-control {}'.format(css_class)
@register.simple_tag
def settings_value(name):
return getattr(settings, name, '')

View File

@ -158,6 +158,8 @@ EMAIL_PORT = 25
URL_LOCATION_PROCESSOR = 'http://127.0.0.1:8000/billard/process_locationdata' URL_LOCATION_PROCESSOR = 'http://127.0.0.1:8000/billard/process_locationdata'
PRODUCT_INFO = 'CAROM-DEV'
try: try:
from local_settings import * from local_settings import *
except ImportError: except ImportError:

View File

@ -1,10 +1,10 @@
{% load static %}<!DOCTYPE html> {% load static form_tags %}<!DOCTYPE html>
<html lang="de"> <html lang="de">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>carom - {% block title %}TITLE SETZEN{% endblock %}</title> <title>{% settings_value "PRODUCT_INFO" %} - {% block title %}TITLE SETZEN{% endblock %}</title>
<meta name="description" content="carom billard management"> <meta name="description" content="carom billard management">
<meta name="author" content="Robert Einsle <robert@einsle.de>"> <meta name="author" content="Robert Einsle <robert@einsle.de>">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
@ -26,7 +26,7 @@
<div class="wrapper"> <div class="wrapper">
<nav class="navbar navbar-expand-sm navbar-dark bg-dark"> <nav class="navbar navbar-expand-sm navbar-dark bg-dark">
<div class="container"> <div class="container">
<a class="navbar-brand" href="{% url 'index' %}">carom</a> <a class="navbar-brand" href="{% url 'index' %}">{% settings_value "PRODUCT_INFO" %}</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#mainMenu" <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#mainMenu"
aria-controls="mainMenu" aria-expanded="false" aria-label="Toggle navigation"> aria-controls="mainMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>

View File

@ -1,6 +1,6 @@
{% extends '_base.html' %} {% extends '_base.html' %}
{% load static %} {% load static form_tags %}
{% block stylesheet %} {% block stylesheet %}
<link rel="stylesheet" href="{% static 'css/login.css' %}"> <link rel="stylesheet" href="{% static 'css/login.css' %}">
@ -9,7 +9,7 @@
{% block body %} {% block body %}
<div class="container"> <div class="container">
<h1 class="text-center logo my-4"> <h1 class="text-center logo my-4">
<a href="{% url 'billard:location_index' %}">carom</a> <a href="{% url 'billard:location_index' %}">{% settings_value "PRODUCT_INFO" %}</a>
</h1> </h1>
{% block content %} {% block content %}
{% endblock %} {% endblock %}