Add default option to dbsetting template tag
This commit is contained in:
parent
d40cde2aef
commit
89cd57c2bd
3 changed files with 7 additions and 4 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -2,3 +2,6 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
__pycache__/
|
__pycache__/
|
||||||
migrations/
|
migrations/
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
django_dbsettings.egg-info/
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from django import template
|
from django import template
|
||||||
from dbsettings.models import Setting
|
from dbsettings.functions import getValue
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def dbsetting(key):
|
def dbsetting(key, default=""):
|
||||||
return Setting.objects.get(key=key).value # pylint: disable=no-member
|
return getValue(key, default)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = django-dbsettings
|
name = django-dbsettings
|
||||||
version = 0.8
|
version = 0.8.1
|
||||||
description = A Django app to store key-value pairs in the database
|
description = A Django app to store key-value pairs in the database
|
||||||
long_description = file: README.md
|
long_description = file: README.md
|
||||||
url = https://kumig.it/kumisystems/dbsettings
|
url = https://kumig.it/kumisystems/dbsettings
|
||||||
|
|
Loading…
Reference in a new issue