From 47c7a84781ea1314733189e0b47adf751e889394 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Sat, 18 Jan 2020 22:48:10 +0100 Subject: [PATCH] Missing migration, add dbsetting template tag --- migrations/0002_auto_20200117_1624.py | 23 +++++++++++++++++++++++ templatetags/__init__.py | 0 templatetags/dbsetting.py | 8 ++++++++ 3 files changed, 31 insertions(+) create mode 100644 migrations/0002_auto_20200117_1624.py create mode 100644 templatetags/__init__.py create mode 100644 templatetags/dbsetting.py diff --git a/migrations/0002_auto_20200117_1624.py b/migrations/0002_auto_20200117_1624.py new file mode 100644 index 0000000..dcf4cb5 --- /dev/null +++ b/migrations/0002_auto_20200117_1624.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.6 on 2020-01-17 15:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dbsettings', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='setting', + name='key', + field=models.CharField(max_length=255, primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='setting', + name='value', + field=models.CharField(max_length=255), + ), + ] diff --git a/templatetags/__init__.py b/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/templatetags/dbsetting.py b/templatetags/dbsetting.py new file mode 100644 index 0000000..1e8e315 --- /dev/null +++ b/templatetags/dbsetting.py @@ -0,0 +1,8 @@ +from django import template +from dbsettings.models import Setting + +register = template.Library() + +@register.simple_tag +def dbsetting(key): + return Setting.objects.get(key=key).value # pylint: disable=no-member \ No newline at end of file