aboutsummaryrefslogtreecommitdiff
path: root/lesana/collection.py
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-09-20 13:24:28 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-09-20 13:24:28 +0200
commit299398ce87fd67a4a24074719b764ac5af300331 (patch)
treebfcf9e6f85b63dcb7522c07080147840ffd4c059 /lesana/collection.py
parent5bd4b53d619ea14cd01a2e5adbfd1f2b8992ab9c (diff)
Add the ability to set a default value for a field.
Diffstat (limited to 'lesana/collection.py')
-rw-r--r--lesana/collection.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lesana/collection.py b/lesana/collection.py
index a8980eb..d2f029d 100644
--- a/lesana/collection.py
+++ b/lesana/collection.py
@@ -51,7 +51,9 @@ class Entry(object):
if not field.get('help', None) is None:
data += "# {name} ({type}): {help}\n".format(**field)
t = field['type']
- if t == 'string':
+ if field.get('default', None):
+ data += ("{name}: '{default}'\n".format(**field))
+ elif t == 'string':
data += ("{name}: ''\n".format(**field))
elif t == 'text':
data += ("{name}: |\n .\n".format(**field))