Arbitrary metadata documentation.
This commit is contained in:
parent
a57f28ac83
commit
50b271c868
@ -172,11 +172,11 @@ arguments can be set on all fields:
|
|||||||
class Shirt(Document):
|
class Shirt(Document):
|
||||||
size = StringField(max_length=3, choices=SIZE)
|
size = StringField(max_length=3, choices=SIZE)
|
||||||
|
|
||||||
:attr:`help_text` (Default: None)
|
:attr:`**kwargs` (Optional)
|
||||||
Optional help text to output with the field -- used by form libraries
|
You can supply additional metadata as arbitrary additional keyword
|
||||||
|
arguments. You can not override existing attributes, however. Common
|
||||||
:attr:`verbose_name` (Default: None)
|
choices include `help_text` and `verbose_name`, commonly used by form and
|
||||||
Optional human-readable name for the field -- used by form libraries
|
widget libraries.
|
||||||
|
|
||||||
|
|
||||||
List fields
|
List fields
|
||||||
|
@ -64,7 +64,11 @@ class BaseField(object):
|
|||||||
then the default value is set
|
then the default value is set
|
||||||
:param sparse: (optional) `sparse=True` combined with `unique=True` and `required=False`
|
:param sparse: (optional) `sparse=True` combined with `unique=True` and `required=False`
|
||||||
means that uniqueness won't be enforced for `None` values
|
means that uniqueness won't be enforced for `None` values
|
||||||
:param **kwargs: (optional) Arbitrary indirection-free metadata for this field.
|
:param **kwargs: (optional) Arbitrary indirection-free metadata for
|
||||||
|
this field can be supplied as additional keyword arguments and
|
||||||
|
accessed as attributes of the field. Must not conflict with any
|
||||||
|
existing attributes. Common metadata includes `verbose_name` and
|
||||||
|
`help_text`.
|
||||||
"""
|
"""
|
||||||
self.db_field = (db_field or name) if not primary_key else '_id'
|
self.db_field = (db_field or name) if not primary_key else '_id'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user