Missing migration, add dbsetting template tag
This commit is contained in:
parent
99f0ccaf72
commit
47c7a84781
3 changed files with 31 additions and 0 deletions
23
migrations/0002_auto_20200117_1624.py
Normal file
23
migrations/0002_auto_20200117_1624.py
Normal file
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
0
templatetags/__init__.py
Normal file
0
templatetags/__init__.py
Normal file
8
templatetags/dbsetting.py
Normal file
8
templatetags/dbsetting.py
Normal file
|
@ -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
|
Loading…
Reference in a new issue