Skip to content

Commit 50b271c

Browse files
committed
Arbitrary metadata documentation.
1 parent a57f28a commit 50b271c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

docs/guide/defining-documents.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ arguments can be set on all fields:
172172
class Shirt(Document):
173173
size = StringField(max_length=3, choices=SIZE)
174174

175-
:attr:`help_text` (Default: None)
176-
Optional help text to output with the field -- used by form libraries
177-
178-
:attr:`verbose_name` (Default: None)
179-
Optional human-readable name for the field -- used by form libraries
175+
:attr:`**kwargs` (Optional)
176+
You can supply additional metadata as arbitrary additional keyword
177+
arguments. You can not override existing attributes, however. Common
178+
choices include `help_text` and `verbose_name`, commonly used by form and
179+
widget libraries.
180180

181181

182182
List fields

mongoengine/base/fields.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ def __init__(self, db_field=None, name=None, required=False, default=None,
6464
then the default value is set
6565
:param sparse: (optional) `sparse=True` combined with `unique=True` and `required=False`
6666
means that uniqueness won't be enforced for `None` values
67-
:param **kwargs: (optional) Arbitrary indirection-free metadata for this field.
67+
:param **kwargs: (optional) Arbitrary indirection-free metadata for
68+
this field can be supplied as additional keyword arguments and
69+
accessed as attributes of the field. Must not conflict with any
70+
existing attributes. Common metadata includes `verbose_name` and
71+
`help_text`.
6872
"""
6973
self.db_field = (db_field or name) if not primary_key else '_id'
7074

0 commit comments

Comments
 (0)