python.shotgun_model.simple_shotgun_model module¶
-
class
SimpleShotgunModel
(parent, bg_task_manager=None)[source]¶ Bases:
python.shotgun_model.shotgun_model.ShotgunModel
Convenience wrapper around the Shotgun model for quick and easy access.
Use this when you want to prototype data modeling or if your are looking for a simple flat data set reflecting a shotgun query. All you need to do is to instantiate the class (typically once, in your constructor) and then call
load_data()
to specify which shotgun query to load up in the model. Subsequently callload_data()
whenever you wish to change the Shotgun query associated with the model.This class derives from
ShotgunModel
so all the customization methods available in the normalShotgunModel
can also be subclassed from this class.-
load_data
(entity_type, filters=None, fields=None, order=None, limit=None, columns=None, additional_filter_presets=None, editable_columns=None)[source]¶ Loads shotgun data into the model, using the cache if possible. The model is not nested and the first field that is specified via the fields parameter (
code
by default) will be used as the default name for all model items.Parameters: - entity_type – Shotgun Entity Type to load data for
- filters – Shotgun API find-style filter list. If no list is specified, all records for the given entity type will be retrieved.
- fields – List of Shotgun fields to retrieve. If not spefified, the ‘code’ field will be retrieved.
- order – Order clause for the Shotgun data. Standard Shotgun API syntax. Note that this is an advanced parameter which is meant to be used in subclassing only. The model itself will be ordered by its default display name, and if any other type of ordering is desirable, use for example a QProxyModel to handle this. However, knowing in which order results will arrive from Shotgun can be beneficial if you are doing grouping, deferred loading and aggregation of data as part of your subclassed implementation.
- limit – Limit the number of results returned from Shotgun. In conjunction with the order parameter, this can be used to effectively cap the data set that the model is handling, allowing a user to for example show the twenty most recent notes or similar.
- columns (list) – List of Shotgun fields names to use to populate the model columns
- additional_filter_presets – List of Shotgun filter presets to apply, e.g.
[{"preset_name":"LATEST","latest_by":"BY_PIPELINE_STEP_NUMBER_AND_ENTITIES_CREATED_AT"}]
- editable_columns (list) – A subset of
columns
that will be editable in views that use this model.
-