Item#
- class ansys.dynamicreporting.core.serverless.item.Item(*args, **kwargs)#
Bases:
BaseModelBase class for all persisted report items.
Items are typed containers of content linked to a
Sessionand aDataset. Concrete subclasses define the content validator andtypestring and are registered automatically so that_from_db()andcreate()can dispatch to the correct subclass based on the stored type.Methods
Item.add_tag(tag[, value])Add or update a single tag.
Item.as_dict([recursive])Serialize the model into a plain dictionary.
Item.create(**kwargs)Factory-style creation that dispatches to the correct subclass.
Delete this object from the database.
Item.filter(**kwargs)Return a collection of items, scoped by subclass type.
Item.find([query])Search for items using an ADR query string.
Item.get(**kwargs)Retrieve a single item instance, scoped by subclass type.
Return the raw tag string stored on this object.
Reset the in-memory ORM state for this object.
Item.rem_tag(tag)Remove a tag by key, if it exists.
Item.remove_tag(tag)Alias for
rem_tag()for backwards compatibility.Item.render(*[, context, request])Render the item as HTML.
Item.save(**kwargs)Save the item, enforcing that session and dataset are persisted.
Item.set_tags(tag_str)Replace all tags with the given tag string.
Attributes
Payload content for the item.
Dataset associated with this item.
Database alias in which this object is stored.
Human-readable name for the item.
Whether this object has been successfully saved to the database.
Sequence index for ordering items within a dataset/session.
Session that owns this item.
Optional free-form source identifier for this item.
Tag string used to group and filter objects.
Item type identifier, normally set by subclasses.
Timestamp when the item was created.
Globally unique identifier for this object.
- content: ItemContent = None#
Payload content for the item.
- classmethod create(**kwargs)#
Factory-style creation that dispatches to the correct subclass.
When invoked on
Item, the caller must provide atypekeyword argument identifying the desired item type. For concrete subclasses,typeis injected automatically.
- classmethod filter(**kwargs)#
Return a collection of items, scoped by subclass type.
- Parameters:
- **kwargs
Key-value filters to find matching items. Eg:
source="Simulation 1"
- Returns:
ObjectSetCollection of matching items.
- classmethod find(query='')#
Search for items using an ADR query string.
For typed subclasses, an
i_typefilter is not allowed.
- classmethod get(**kwargs)#
Retrieve a single item instance, scoped by subclass type.
- save(**kwargs)#
Save the item, enforcing that session and dataset are persisted.
- Parameters:
- **kwargs
Keyword arguments forwarded to the database
savemethod of the underlying ORM instance. For eg: Theusingargument can be used to select the target database alias.
- Raises:
ADRExceptionIf the session or dataset is missing.
Session.NotSavedIf the associated session has not been saved.
Dataset.NotSavedIf the associated dataset has not been saved.