View source on GitHub
|
A property that stores a list of things.
Inherits From: Property, expected_type
google.appengine.ext.db.ListProperty(
item_type, verbose_name=None, default=None, write_empty_list=None, **kwds
)
This is a parameterized property; the parameter must be a valid non-list data type, and all items must conform to this type.
Args | |
|---|---|
item_type
|
Type for the list items; must be one of the allowed property types. |
verbose_name
|
Optional verbose name. |
write_empty_list
|
Optional whether to write empty list properties or no property |
default
|
Optional default value; if omitted, an empty list is used. |
**kwds
|
Optional additional keyword arguments, passed to base class. Note
that the only permissible value for required is True.
|
Child Classes
Methods
datastore_type
datastore_type()
Deprecated backwards-compatible accessor method for self.data_type.
default_value
default_value()
Default value for list.
Because the property supplied to default is a static value,
that value must be shallow copied to prevent all fields with
default values from sharing the same instance.
| Returns | |
|---|---|
| Copy of the default value. |
empty
empty(
value
)
Is list property empty.
[] is not an empty value.
| Returns | |
|---|---|
True if value is None, else False.
|
get_updated_value_for_datastore
get_updated_value_for_datastore(
model_instance
)
Determine new value for auto-updated property.
Some properies (e.g. DateTimeProperty, UserProperty) optionally update
their value on every put(). This call must return the new desired value
for such properties. For all other properties, this call must return
AUTO_UPDATE_UNCHANGED.
| Args | |
|---|---|
model_instance
|
Instance to get new value for. |
| Returns | |
|---|---|
Datastore representation of the new model value in a form that is
appropriate for storing in the datastore, or AUTO_UPDATE_UNCHANGED.
|
get_value_for_datastore
get_value_for_datastore(
model_instance
)
Get value from property to send to datastore.
| Returns | |
|---|---|
| validated list appropriate to save in the datastore. |
make_value_from_datastore
make_value_from_datastore(
value
)
Native representation of this property.
If this list is a list of datetime.date or datetime.time, we convert
the list of datetime.datetime retrieved from the entity into
datetime.date or datetime.time.
See base class method documentation for details.
make_value_from_datastore_index_value
make_value_from_datastore_index_value(
index_value
)
validate
validate(
value
)
Validate list.
| Returns | |
|---|---|
| A valid value. |
| Raises | |
|---|---|
BadValueError if property is not a list whose items are instances of
the item_type given to the constructor.
|
validate_list_contents
validate_list_contents(
value
)
Validates that all items in the list are of the correct type.
| Returns | |
|---|---|
| The validated list. |
| Raises | |
|---|---|
BadValueError if the list has items are not instances of the
item_type given to the constructor.
|
Class Variables | |
|---|---|
| creation_counter |
2
|
View source on GitHub