onadata.libs.models package¶
Submodules¶
onadata.libs.models.base_model module¶
onadata.libs.models.clone_xform module¶
CloneXForm class model.
- class onadata.libs.models.clone_xform.CloneXForm(xform, username, project=None)¶
Bases:
object
The class takes an existing form’s XLSForm and publishes it as a new form.
- save(**kwargs)¶
Publishes an exiting form’s XLSForm as a new form.
- property user¶
Returns a User object for the given
self.username
.
onadata.libs.models.signals module¶
onadata.libs.models.signals module
- onadata.libs.models.signals.add_tags_to_xform_instances(sender, **kwargs)¶
Adds tags to an xform instance.
- onadata.libs.models.signals.delete_tag_from_xform_instances(sender, **kwargs)¶
Deletes tags associated with an xform when it is deleted.
onadata.libs.models.sorting module¶
Sorting utility functions.
- onadata.libs.models.sorting.json_order_by(sort_list, none_json_fields: Dict | None = None, model_name: str = '')¶
Returns SQL ORDER BY string portion based on JSON input.
- onadata.libs.models.sorting.json_order_by_params(sort_list, none_json_fields: Dict | None = None)¶
Creates the ORDER BY parameters list from JSON input.
- onadata.libs.models.sorting.sort_from_mongo_sort_str(sort_str)¶
Create a sort query list based on MongoDB sort string input.
onadata.libs.models.textit_service module¶
TextItService model: sets up all properties for interaction with TextIt or RapidPro.
- class onadata.libs.models.textit_service.TextItService(xform, service_url=None, name=None, auth_token=None, flow_uuid=None, contacts=None, pk=None, flow_title: str = '')¶
Bases:
object
TextItService model: access/create/update RestService and MetaData objects with all properties for TextIt or RapidPro like services.
- retrieve()¶
Sets the textit or rapidpro properties from the MetaData object. The properties are:
auth_token
flow_uuid
contacts
- save()¶
Creates and updates RestService and MetaData objects with textit or rapidpro service properties.