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
|
||||
__pycache__/
|
||||
migrations/
|
||||
build/
|
||||
dist/
|
||||
django_dbsettings.egg-info/
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django import template
|
||||
from dbsettings.models import Setting
|
||||
from dbsettings.functions import getValue
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.simple_tag
|
||||
def dbsetting(key):
|
||||
return Setting.objects.get(key=key).value # pylint: disable=no-member
|
||||
def dbsetting(key, default=""):
|
||||
return getValue(key, default)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = django-dbsettings
|
||||
version = 0.8
|
||||
version = 0.8.1
|
||||
description = A Django app to store key-value pairs in the database
|
||||
long_description = file: README.md
|
||||
url = https://kumig.it/kumisystems/dbsettings
|
||||
|
|
Loading…
Reference in a new issue