moo.core.models.object.Object
- class moo.core.models.object.Object(id, name, unique_name, obvious, placement_prep, placement_target, owner, location, site, _initialized)
- __init__(*args, **kwargs)
Methods
__init__(*args, **kwargs)add_alias(alias)Add an alias to this object if it does not already exist.
add_parent(parent)Add a parent to this object's inheritance chain.
add_verb(*names[, code, owner, repo, ...])Create or replace a
Verbon this object.adelete([using, keep_parents])allow(accessor, permission)Allow a certain object or group to do something on this object.
arefresh_from_db([using, fields])asave([force_insert, force_update, using, ...])can_caller(permission, subject)Check if the current caller has permission for something.
check(**kwargs)clean()Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields.
clean_fields([exclude])Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
clear_placement()Remove placement without touching the obvious field.
contains(obj)Check if this object contains the given object anywhere in its content tree.
date_error_message(lookup_type, field_name, ...)delete(*args, **kwargs)deny(accessor, permission)Deny a certain object or group from doing something on this object.
find(name[, exclude_hidden_placement])Find contents by the given name or alias.
from_db(db, field_names, values)full_clean([exclude, validate_unique, ...])Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model.
get_ancestors()Get the ancestor tree for this object as a QuerySet ordered shallowest-first.
get_constraints()get_contents()Get the content tree for this object as a QuerySet ordered shallowest-first.
get_deferred_fields()Return a set containing names of deferred fields for this instance.
get_descendents()Get the descendent tree for this object as a QuerySet ordered shallowest-first.
get_property(name[, recurse, original])Retrieve a
Propertyinstance defined on this Object.get_property_objects(name[, ...])Like
get_property(), but when the stored value is a list of Objects, returns them via a single bulkINquery with optional prefetches instead of the N individualget()calls thatmoojson.loads()would issue.get_verb(name[, recurse, allow_ambiguous, ...])Retrieve a specific
Verbinstance defined on this Object.has_property(name[, recurse])Check if a particular
Propertyis defined on this object.has_verb(name[, recurse])Check if a particular
Verbis defined on this object.invoke_verb(name, *args, **kwargs)Invoke a
Verbdefined on the given object, traversing the inheritance tree until it's found.is_a(obj)Check if this object is a child of the provided object.
is_allowed(permission, subject[, fatal])Check if this object is allowed to perform an action on an object.
is_connected()Check if this object is a player avatar that is currently connected.
is_hidden_placement()True for prepositions that hide the item in tell_contents (under, behind).
is_named(name)Check if this object has a name or alias that matches the given name.
is_placed()True if this object has an active placement.
is_player()Check if this object is a player avatar.
is_wizard()Check if this object is a wizard player avatar.
owns(subject)Convenience method to check if the subject is owned by self
prepare_database_save(field)refresh_from_db([using, fields])Reload field values from the database.
remove_parent(parent)Remove a parent from this object's inheritance chain.
save(*args, **kwargs)Save the current instance.
save_base([raw, force_insert, force_update, ...])Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too.
serializable_value(field_name)Return the value of the field name for this instance.
set_placement(prep, target)Set placement prep and target atomically.
set_property(name, value[, inherit_owner, owner])Create or update a
Propertyon this object.unique_error_message(model_class, unique_check)validate_constraints([exclude])validate_unique([exclude])Check unique constraints on the model and raise ValidationError if any failed.
Attributes
aclAccessor to the related objects manager on the reverse side of a many-to-one relation.
aliasesAccessor to the related objects manager on the reverse side of a many-to-one relation.
ancestor_cacheAccessor to the related objects manager on the reverse side of a many-to-one relation.
ancestor_descendantsAccessor to the related objects manager on the reverse side of a many-to-one relation.
childrenAccessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
contentsAccessor to the related objects manager on the reverse side of a many-to-one relation.
global_objectsidA wrapper for a deferred-loading field.
kindlocationThe location of this object.
location_idnameThe canonical name of the object
objectsobviousThis object should be obvious among a group.
ownerThe owner of this object.
owner_idparentsThe parents of this object.
pkplaced_objectsAccessor to the related objects manager on the reverse side of a many-to-one relation.
placementReturn
(prep, target)tuple, orNoneif not placed (or target deleted).placement_prepThe preposition describing where this object is placed (e.g. "on", "under").
placement_targetThe object this is placed on/under/behind.
placement_target_idplayer_setAccessor to the related objects manager on the reverse side of a many-to-one relation.
propertiesAccessor to the related objects manager on the reverse side of a many-to-one relation.
received_messagesAccessor to the related objects manager on the reverse side of a many-to-one relation.
rightsAccessor to the related objects manager on the reverse side of a many-to-one relation.
sent_messagesAccessor to the related objects manager on the reverse side of a many-to-one relation.
siteAccessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
site_idunique_nameIf True, this object is the only object with this name
verbsAccessor to the related objects manager on the reverse side of a many-to-one relation.