onadata.apps.logger.models package¶
Subpackages¶
Submodules¶
onadata.apps.logger.models.attachment module¶
Attachment model.
- class onadata.apps.logger.models.attachment.Attachment(*args, **kwargs)¶
Bases:
Model
Attachment model.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- OSM = 'osm'¶
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- deleted_by_id¶
- extension¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property file_hash¶
Returns the MD5 hash of the file.
- file_size¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property filename¶
Returns the attachment’s filename.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instance¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- instance_id¶
- media_file¶
The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assign a file object on assignment so you can do:
>>> with open('/path/to/hello.world') as f: ... instance.file = File(f)
- mimetype¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- save(*args, **kwargs)¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- xform¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- xform_id¶
- onadata.apps.logger.models.attachment.get_original_filename(filename)¶
Returns the filename removing the hashed random string added to it when we have file duplicates in some file systems.
- onadata.apps.logger.models.attachment.upload_to(instance, filename)¶
Returns the attachments folder to upload the file to.
onadata.apps.logger.models.data_view module¶
DataView model class
- class onadata.apps.logger.models.data_view.DataView(*args, **kwargs)¶
Bases:
Model
Model to provide filtered access to the underlying data of an XForm
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- columns¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- deleted_by_id¶
- classmethod generate_query_string(data_view, start_index, limit, last_submission_time, all_data, sort, filter_query=None)¶
Returns an SQL string based on the passed in parameters.
- get_known_dates()¶
Return elements of type date
- get_known_decimals()¶
Return elements of type decimal
- get_known_integers()¶
Return elements of type integer
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- has_geo_columnn_n_data()¶
Check if the data set from the data view has geo location data :return: boolean True if present
- has_instance(instance)¶
Return True if instance in set of dataview data
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instances_with_geopoints¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- matches_parent¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- project¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- project_id¶
- query¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod query_data(data_view, start_index=None, limit=None, count=None, last_submission_time=False, all_data=False, sort=None, filter_query=None)¶
Returns a list of records for the view based on the parameters passed in.
- classmethod query_iterator(sql, fields=None, params=None, count=False)¶
A database query iterator.
- restore()¶
Restore the dataview by removing the timestamped suffix from the name and setting the deleted_at field to None.
- save(*args, **kwargs)¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- soft_delete(user=None)¶
Mark the dataview as soft deleted, appending a timestamped suffix to the name to make the initial values available without violating the uniqueness constraint.
- xform¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- xform_id¶
- onadata.apps.logger.models.data_view.append_where_list(comp, t_list, json_str)¶
Concatenates an SQL query based on the
comp
comparison value.
- onadata.apps.logger.models.data_view.clear_cache(sender, instance, **kwargs)¶
Post delete handler for clearing the dataview cache.
- onadata.apps.logger.models.data_view.clear_dataview_cache(sender, instance, **kwargs)¶
Post Save handler for clearing dataview cache on serialized fields.
- onadata.apps.logger.models.data_view.get_elements_of_type(xform, field_type)¶
This function returns a list of column names of a specified type
- onadata.apps.logger.models.data_view.get_name_from_survey_element(element)¶
Returns the abbreviated xpath of a given
SurveyElement
.
- onadata.apps.logger.models.data_view.has_attachments_fields(data_view)¶
This function checks if any column of the dataview is of type photo, video or audio (attachments fields). It returns a boolean value.
onadata.apps.logger.models.entity module¶
Entity model
- class onadata.apps.logger.models.entity.Entity(*args, **kwargs)¶
Bases:
BaseModel
An entity created by a registration form
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- deleted_by_id¶
- entity_list¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- entity_list_id¶
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- history¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- json¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- soft_delete(deleted_by=None)¶
Soft delete Entity
- uuid¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class onadata.apps.logger.models.entity.EntityHistory(*args, **kwargs)¶
Bases:
BaseModel
Maintains a history of Entity updates
An Entity can be created/updated from a form or via API
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- created_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- created_by_id¶
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- entity¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- entity_id¶
- form_version¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instance¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- instance_id¶
- json¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- registration_form¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- registration_form_id¶
- xml¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
onadata.apps.logger.models.entity_list module¶
EntityList model
- class onadata.apps.logger.models.entity_list.EntityList(*args, **kwargs)¶
Bases:
BaseModel
The dataset where each entity will be save to
Entities of the same type are organized in entity lists
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- deleted_by_id¶
- entities¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- entitylistgroupobjectpermission_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- entitylistuserobjectpermission_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- exports¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- follow_up_forms¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_entity_update_time¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- num_entities¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- project¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- project_id¶
- property properties: list[str]¶
All dataset properties
Multiple forms can define matching or different properties for the same dataset
- Returns:
list: properties defined by all forms creating Entities for the dataset
- registration_forms¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- soft_delete(deleted_by=None)¶
Soft delete EntityList
- class onadata.apps.logger.models.entity_list.EntityListGroupObjectPermission(*args, **kwargs)¶
Bases:
GroupObjectPermissionBase
Guardian model to create direct foreign keys.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- content_object¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- content_object_id¶
- group¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- group_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- permission¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- permission_id¶
- class onadata.apps.logger.models.entity_list.EntityListUserObjectPermission(*args, **kwargs)¶
Bases:
UserObjectPermissionBase
Guardian model to create direct foreign keys.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- content_object¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- content_object_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- permission¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- permission_id¶
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
onadata.apps.logger.models.follow_up_form module¶
FollowUpForm model
- class onadata.apps.logger.models.follow_up_form.FollowUpForm(*args, **kwargs)¶
Bases:
BaseModel
Forms that consumes entities from an entity list
No changes are made to any entities
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- entity_list¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- entity_list_id¶
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_active¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- xform¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- xform_id¶
onadata.apps.logger.models.instance module¶
Instance model class
- exception onadata.apps.logger.models.instance.FormInactiveError¶
Bases:
Exception
Exception class for inactive forms
- exception onadata.apps.logger.models.instance.FormIsMergedDatasetError¶
Bases:
Exception
Exception class for merged datasets
- class onadata.apps.logger.models.instance.Instance(*args, **kwargs)¶
Bases:
Model
,InstanceBaseClass
Model representing a single submission to an XForm
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- attachments¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property attachments_count¶
Returns the number of attachments a submission has.
- checksum¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- deleted_by_id¶
- entity_history¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- geom¶
- get_expected_media()¶
Returns a list of expected media files from the submission data.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- has_a_review¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- json¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_edited¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- media_all_received¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- media_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- notes¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property num_of_media¶
Returns number of media attachments expected in the submission.
- objects = <django.db.models.manager.Manager object>¶
- osm_data¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- parsed_instance¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- reviews¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- save(*args, **kwargs)¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- set_deleted(deleted_at=datetime.datetime(2024, 12, 10, 12, 53, 16, 374106, tzinfo=datetime.timezone.utc), user=None)¶
Set the timestamp and user when a submission is deleted.
- classmethod set_deleted_at(instance_id, deleted_at=datetime.datetime(2024, 12, 10, 12, 53, 16, 374094, tzinfo=datetime.timezone.utc), user=None)¶
Set’s the timestamp when a submission was deleted.
- soft_delete_attachments(user=None)¶
Soft deletes an attachment by adding a deleted_at timestamp.
- status¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- submission_history¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- survey_type¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- survey_type_id¶
- tagged_items¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- tags = <taggit.managers._TaggableManager object>¶
- total_media¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- uuid¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- version¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- xform¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- xform_id¶
- xml¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class onadata.apps.logger.models.instance.InstanceBaseClass¶
Bases:
object
Interface of functions for Instance and InstanceHistory model
- get(abbreviated_xpath)¶
Returns the XML element at the
abbreviated_xpath
.
- get_dict(force_new=False, flat=True)¶
Return a python object representation of this instance’s XML.
- get_duration()¶
Returns the duration between the start and end questions of a form.
- get_full_dict(include_related=True)¶
Returns the submission XML as a python dictionary object
Include metadata
- Args:
include_related (bool): Whether to include related objects or not
- get_latest_review()¶
Returns the latest review. Used in favour of get_review_status_and_comment.
- get_notes()¶
Returns a list of notes.
- get_review_status_and_comment()¶
Return a tuple of review status and comment.
- get_root_node()¶
Returns the XML submission’s root node.
- get_root_node_name()¶
Returns the XML submission’s root node name.
- numeric_converter(json_dict, numeric_fields=None)¶
Converts strings in a python object
json_dict
to their numeric value.
- property point¶
Returns the Point of the first geom if it is a collection.
- class onadata.apps.logger.models.instance.InstanceHistory(*args, **kwargs)¶
Bases:
Model
,InstanceBaseClass
Stores deleted submission XML to maintain a history of edits.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- property attachments¶
Returns the attachments linked to this submission.
- checksum¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property deleted_at¶
Mutes the deleted_at method for the history record.
- geom¶
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- property has_a_review¶
Returns the value of a submission.has_a_review.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property json¶
Returns the XML submission as a python dictionary object.
- property media_all_received¶
Returns the value of the submission.media_all_received.
- property media_count¶
Returns the number of media attached to the submission.
- property notes¶
Returns the notes attached to the submission.
- objects = <django.db.models.manager.Manager object>¶
- property osm_data¶
Returns the OSM data for the submission.
- property reviews¶
Returns the submission reviews.
- classmethod set_deleted_at(instance_id, deleted_at=datetime.datetime(2024, 12, 10, 12, 53, 16, 375291, tzinfo=datetime.timezone.utc))¶
Mutes the set_deleted_at method for the history record.
- property status¶
Returns the submission’s status
- submission_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property tags¶
Returns the tags linked to the submission.
- property total_media¶
Returns the number of attachments linked to submission.
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- uuid¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property version¶
Returns the XForm verison for the submission.
- property xform¶
Returns the XForm object linked to this submission.
- xform_instance¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- xform_instance_id¶
- xml¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- onadata.apps.logger.models.instance.convert_to_serializable_date(date)¶
Returns the ISO format of a date object if it has the attribute ‘isoformat’.
- onadata.apps.logger.models.instance.get_attachment_url(attachment, suffix=None)¶
Returns the attachment URL for a given suffix
- onadata.apps.logger.models.instance.get_id_string_from_xml_str(xml_str)¶
Parses an XML
xml_str
and returns the top level id string.
- onadata.apps.logger.models.instance.now()¶
Returns current timestamp via timezone.now().
- onadata.apps.logger.models.instance.numeric_checker(string_value)¶
Checks if a
string_value
is a numeric value.
- onadata.apps.logger.models.instance.permanently_delete_attachments(sender, instance=None, created=False, **kwargs)¶
- onadata.apps.logger.models.instance.post_save_submission(sender, instance=None, created=False, **kwargs)¶
Update XForm, Project, JSON field
XForm submission count & instances_with_geopoints field
Project date modified
- Update the submission JSON field data. We save the full_json in
post_save signal because some implementations in get_full_dict require the id to be available
- onadata.apps.logger.models.instance.save_full_json(instance: Instance, include_related=True)¶
Save full json dict
- Args:
include_related (bool): Whether to include related objects
- onadata.apps.logger.models.instance.update_project_date_modified(instance_id, _)¶
Update the project’s date_modified
Changes the etag value of the projects endpoint.
- onadata.apps.logger.models.instance.update_xform_submission_count(instance_id, created)¶
Updates the XForm submissions count on a new submission being created.
- onadata.apps.logger.models.instance.update_xform_submission_count_delete(sender, instance, **kwargs)¶
Updates the XForm submissions count on deletion of a submission.
onadata.apps.logger.models.merged_xform module¶
MergedXForm model - stores info on forms to merge.
- class onadata.apps.logger.models.merged_xform.MergedXForm(*args, **kwargs)¶
Bases:
XForm
Merged XForms
- exception DoesNotExist¶
Bases:
DoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- metadata_set¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- save(*args, **kwargs)¶
Sets additional form properties before saving to the DB
- tagged_items¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- xform_ptr¶
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- xform_ptr_id¶
- xforms¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- onadata.apps.logger.models.merged_xform.set_object_permissions(sender, instance=None, created=False, **kwargs)¶
Set object permissions when a MergedXForm has been created.
onadata.apps.logger.models.note module¶
Note Model Module
- class onadata.apps.logger.models.note.Note(*args, **kwargs)¶
Bases:
Model
Note Model Class
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- created_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- created_by_id¶
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_data()¶
Returns Note data as a dictionary
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instance¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- instance_field¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instance_id¶
- note¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- notes¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- objects = <django.db.models.manager.Manager object>¶
onadata.apps.logger.models.open_data module¶
OpenData model represents a way to access private datasets without authentication using the unique uuid.
- class onadata.apps.logger.models.open_data.OpenData(*args, **kwargs)¶
Bases:
Model
OpenData model represents a way to access private datasets without authentication using the unique uuid.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- active¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- content_object¶
Provide a generic many-to-one relation through the
content_type
andobject_id
fields.This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.
- content_type¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- content_type_id¶
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- object_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- uuid¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- onadata.apps.logger.models.open_data.get_or_create_opendata(xform)¶
Looks up an OpenData object with the given xform, creates one if it does not exist. Returns a tuple of (object, created), where created is a boolean specifing whether an object was created.
onadata.apps.logger.models.osmdata module¶
OSM Data model class
- class onadata.apps.logger.models.osmdata.OsmData(*args, **kwargs)¶
Bases:
Model
OSM Data information from a submission instance
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- field_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- filename¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- geom¶
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- classmethod get_tag_keys(xform, field_path, include_prefix=False)¶
Returns sorted tag keys.
- get_tags_with_prefix()¶
Returns tags prefixed by the field_name.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instance¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- instance_id¶
- objects = <django.db.models.manager.Manager object>¶
- osm_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- osm_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- save(force_insert=False, force_update=False, using=None, update_fields=None)¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- tags¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- xml¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
onadata.apps.logger.models.project module¶
Project model class
- class onadata.apps.logger.models.project.PrefetchManager(*args, **kwargs)¶
Bases:
Manager
Project prefetched manager - prefetches models related to the Project model.
- get_queryset()¶
Return a queryset with the XForm, Team, tags, and other related relations prefetched.
- class onadata.apps.logger.models.project.Project(*args, **kwargs)¶
Bases:
BaseModel
Project model class
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- action_object_actions¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- actor_actions¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- clean()¶
Raises a validation error if a project with same name and organization exists.
- created_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- created_by_id¶
- dataview_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- deleted_by_id¶
- entity_lists¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- invitations¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- metadata¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- organization_id¶
- prefetched = <onadata.apps.logger.models.project.PrefetchManager object>¶
- projectgroupobjectpermission_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- projectuserobjectpermission_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- soft_delete(user=None)¶
Soft deletes a project by adding a deleted_at timestamp and renaming the project name by adding a deleted-at and timestamp. Also soft deletes the associated forms. :return:
- tagged_items¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- tags = <taggit.managers._TaggableManager object>¶
- target_actions¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- team_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property user¶
Returns the user who created the project.
- user_stars¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- xform_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class onadata.apps.logger.models.project.ProjectGroupObjectPermission(*args, **kwargs)¶
Bases:
GroupObjectPermissionBase
Guardian model to create direct foreign keys.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- content_object¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- content_object_id¶
- group¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- group_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- permission¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- permission_id¶
- class onadata.apps.logger.models.project.ProjectUserObjectPermission(*args, **kwargs)¶
Bases:
UserObjectPermissionBase
Guardian model to create direct foreign keys.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- content_object¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- content_object_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- permission¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- permission_id¶
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- onadata.apps.logger.models.project.set_object_permissions(sender, instance=None, created=False, **kwargs)¶
Sets permissions to users who are owners of the organization.
onadata.apps.logger.models.project_invitation module¶
ProjectInvitation class
- class onadata.apps.logger.models.project_invitation.ProjectInvitation(*args, **kwargs)¶
Bases:
Model
ProjectInvitation model class
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- class Status(value)¶
Bases:
IntegerChoices
Choices for status field
- ACCEPTED = 2¶
- PENDING = 1¶
- REVOKED = 3¶
- accepted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- accepted_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- accepted_by_id¶
- created_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- email¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)¶
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)¶
- get_status_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: status>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- invited_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- invited_by_id¶
- objects = <django.db.models.manager.Manager object>¶
- project¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- project_id¶
- resent_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- revoked_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- role¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- status¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
onadata.apps.logger.models.registration_form module¶
RegistrationForm model
- class onadata.apps.logger.models.registration_form.RegistrationForm(*args, **kwargs)¶
Bases:
BaseModel
Form that creates entities in an entity list
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- entity_history¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- entity_list¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- entity_list_id¶
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- get_save_to(version: str | None = None) dict[str, str] ¶
Maps the save_to alias to the original field
- Args:
version (str | None): XFormVersion’s version to use to get properties
- Returns:
dict: properties used to create entities mapped to their original names
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_active¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- xform¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- xform_id¶
onadata.apps.logger.models.submission_review module¶
Submission Review Model Module
- class onadata.apps.logger.models.submission_review.SubmissionReview(*args, **kwargs)¶
Bases:
Model
SubmissionReview Model Class
- APPROVED = '1'¶
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- PENDING = '3'¶
- REJECTED = '2'¶
- STATUS_CHOICES = (('1', 'Approved'), ('3', 'Pending'), ('2', 'Rejected'))¶
- created_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- created_by_id¶
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- deleted_by_id¶
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_note_text()¶
Custom Property returns associated note text
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- get_status_display(*, field=<django.db.models.fields.CharField: status>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instance¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- instance_id¶
- note¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- note_id¶
- property note_text¶
Custom Property returns associated note text
- objects = <django.db.models.manager.Manager object>¶
- set_deleted(deleted_at=datetime.datetime(2024, 12, 10, 12, 53, 16, 158370, tzinfo=datetime.timezone.utc), user=None)¶
Sets the deleted_at and deleted_by fields
- status¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- onadata.apps.logger.models.submission_review.create_or_update_entity(sender, instance, created=False, **kwargs)¶
Signal handler to create/update Entity if submission is approved
- onadata.apps.logger.models.submission_review.update_instance_json_on_save(sender, instance, **kwargs)¶
Signal handler to update Instance Json with the submission review on save
onadata.apps.logger.models.survey_type module¶
Survey type model class
- class onadata.apps.logger.models.survey_type.SurveyType(*args, **kwargs)¶
Bases:
Model
Survey type model class
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instance_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- objects = <django.db.models.manager.Manager object>¶
- slug¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
onadata.apps.logger.models.widget module¶
Widget class module.
- class onadata.apps.logger.models.widget.Widget(*args, **kwargs)¶
Bases:
OrderedModel
Widget class - used for storing chart visual information.
- CHARTS = 'charts'¶
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- WIDGETS_TYPES = (('charts', 'Charts'),)¶
- aggregation¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- column¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- content_object¶
Provide a generic many-to-one relation through the
content_type
andobject_id
fields.This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.
- content_type¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- content_type_id¶
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- description¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- get_widget_type_display(*, field=<django.db.models.fields.CharField: widget_type>)¶
- group_by¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- key¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- metadata¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- object_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- order¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- order_with_respect_to = 'content_type'¶
- classmethod query_data(widget)¶
Queries and returns chart information with the data for the chart.
- save(*args, **kwargs)¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- title¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- view_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- widget_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
onadata.apps.logger.models.xform module¶
The XForm model
- class onadata.apps.logger.models.xform.DictOrganizer¶
Bases:
object
Adds parent index information in a submission record.
- get_observation_from_dict(item)¶
Returns a dict that has observations added from
item
.
- set_dict_iterator(dict_iterator)¶
Set’s the dict iterator.
- exception onadata.apps.logger.models.xform.DuplicateUUIDError¶
Bases:
Exception
Exception to raise when there are duplicate UUIDS in an XForm XML.
- class onadata.apps.logger.models.xform.XForm(*args, **kwargs)¶
Bases:
XFormMixin
,BaseModel
XForm model - stores the XLSForm and related data.
- CLONED_SUFFIX = '_cloned'¶
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- MAX_ID_LENGTH = 100¶
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- action_object_actions¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- actor_actions¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- allows_sms¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- bamboo_dataset¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property can_be_replaced¶
Returns True if the form has zero submissions - forms with zero permissions can be replaced.
- created_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- created_by_id¶
- dataview_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- deleted_by_id¶
- description¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- downloadable¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- encrypted¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- export_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- file_name()¶
Returns the XML filename based on the
self.id_string
.
- follow_up_forms¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- geocoded_submission_count()¶
Number of geocoded submissions.
- get_hash()¶
Returns the MD5 hash of the forms XML content prefixed by ‘md5:’
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_next_by_last_updated_at(*, field=<django.db.models.fields.DateTimeField: last_updated_at>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- get_previous_by_last_updated_at(*, field=<django.db.models.fields.DateTimeField: last_updated_at>, is_next=False, **kwargs)¶
- has_hxl_support¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property has_instances_with_geopoints¶
Returns instances with geopoints.
- has_start_time¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- hash¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id_string¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instance_id_regex = re.compile('<instance>.*?id="([^"]+)".*</instance>', re.DOTALL)¶
- instances¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- instances_with_geopoints¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instances_with_osm¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_instance_json_regenerated¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_merged_dataset¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- json¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- json_dict()¶
Returns the self.json field data as a dict.
- last_submission_time¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_updated_at¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- mergedxform¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- mergedxform_ptr¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- metadata_set¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- num_of_submissions¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- project¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- project_id¶
- classmethod public_forms()¶
Returns a queryset of public forms i.e. shared = True
- public_key¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- registration_forms¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- require_auth¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- restore()¶
Restore a soft-deleted XForm
- restservice_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- save(*args, **kwargs)¶
Sets additional form properties before saving to the DB
- set_hash()¶
Sets the MD5 hash of the form.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- sms_id_string¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- soft_delete(user=None)¶
Return the soft deletion timestamp Mark the XForm as soft deleted, appending a timestamped suffix to the id_string and sms_id_string to make the initial values available without violating the uniqueness constraint. Also soft deletes associated dataviews
- submission_count(force_update=False)¶
Returns the form’s number of submission.
- property submission_count_for_today¶
Returns the submissions count for the current day.
- tagged_items¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- tags = <taggit.managers._TaggableManager object>¶
- target_actions¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
- time_of_last_submission()¶
Returns the timestamp of when the latest submission was created.
- time_of_last_submission_update()¶
Returns the timestamp of the last updated submission for the form.
- title¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- update(*args, **kwargs)¶
Persists the form to the DB.
- url()¶
Returns the download URL for the XForm.
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- uuid¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- uuid_bind_location = 4¶
- uuid_node_location = 2¶
- uuid_regex = re.compile('(<instance>.*?id="[^"]+">)(.*</instance>)(.*)', re.DOTALL)¶
- version¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- versions¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- xform_attachments¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- xformgroupobjectpermission_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- xformuserobjectpermission_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- xls¶
The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assign a file object on assignment so you can do:
>>> with open('/path/to/hello.world') as f: ... instance.file = File(f)
- xml¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class onadata.apps.logger.models.xform.XFormGroupObjectPermission(*args, **kwargs)¶
Bases:
GroupObjectPermissionBase
Guardian model to create direct foreign keys.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- content_object¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- content_object_id¶
- group¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- group_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- permission¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- permission_id¶
- class onadata.apps.logger.models.xform.XFormMixin¶
Bases:
object
XForm mixin class - adds helper functions.
- GEODATA_SUFFIXES = ['latitude', 'longitude', 'altitude', 'precision']¶
- PREFIX_NAME_REGEX = re.compile('(?P<prefix>.+/)(?P<name>[^/]+)$')¶
- add_instances()¶
Returns all instances as a list of python objects.
- property default_language¶
Returns the default language
- geopoint_xpaths()¶
Returns the abbreviated_xpath of all fields of type geopoint.
- geotrace_xpaths()¶
Returns the abbreviated_xpath of all fields of type geotrace.
- classmethod get_additional_geopoint_xpaths(xpath)¶
This will return a list of the additional fields that are added per geopoint. For example, given a field ‘group/gps’ it will return ‘group/_gps_(suffix)’ for suffix in DataDictionary.GEODATA_SUFFIXES
- get_child_elements(name_or_xpath, split_select_multiples=True)¶
Returns a list of survey elements children in a flat list. If the element is a group or multiple select the child elements are appended to the list. If the name_or_xpath is a repeat we iterate through the child elements as well.
- get_choice_label(field, choice_value, lang='English')¶
Returns a choice’s label for the given
field
andchoice_value
.
- get_data_for_excel()¶
Returns submissions with select all and geopoint fields expanded
- get_default_language()¶
Returns the default language
- get_element(abbreviated_xpath)¶
Returns an XML element
- get_field_name_xpaths_only()¶
Returns the abbreviated_xpath of all fields in a survey form.
- get_headers(include_additional_headers=False, repeat_iterations=4)¶
Return a list of headers for a csv file.
- get_keys()¶
Return all XForm headers.
- get_label(abbreviated_xpath, elem=None, language=None)¶
Returns the label of given xpath.
- get_language(languages, language_index=0)¶
Returns the language at the given index.
- get_list_of_parsed_instances(flat=True)¶
Return an iterator of all parsed instances.
- get_media_survey_xpaths()¶
Returns all survey element abbreviated_xpath of type in KNOWN_MEDIA_TYPES
- get_mongo_field_names_dict()¶
Return a dictionary of fieldnames as saved in mongodb with corresponding xform field names e.g {“Q1Lg==1”: “Q1.1”}
- get_osm_survey_xpaths()¶
Returns abbreviated_xpath for OSM question types in the survey.
- get_select_multiple_xpaths()¶
Returns abbreviated_xpath for SELECT_ALL_THAT_APPLY questions in the survey.
- get_select_one_xpaths()¶
Returns abbreviated_xpath for SELECT_ONE questions in the survey.
- get_survey()¶
Returns an XML XForm survey object.
- get_survey_element(name_or_xpath)¶
Searches survey element by xpath first, if that fails it searches by name, the first element matching the name will be returned.
- get_survey_elements()¶
Returns an iterator of all survey elements.
- get_survey_elements_of_type(element_type)¶
Returns all survey elements of type
element_type
.
- get_survey_elements_with_choices()¶
Returns all survey elements of type SELECT_ONE and SELECT_ALL_THAT_APPLY.
- get_unique_id_string(id_string, count=0)¶
Checks and returns a unique
id_string
.
- get_variable_name(abbreviated_xpath)¶
If the abbreviated_xpath has been renamed in self.variable_names_json return that new name, otherwise return the original abbreviated_xpath.
- get_xpath_cmp()¶
Compare two xpaths
- property has_id_string_changed¶
Returns the boolean value of _id_string_changed.
- mark_start_time_boolean()¶
Sets True the self.has_start_time if the form has a start meta question.
- polygon_xpaths()¶
Returns the abbreviated_xpath of all fields of type geoshape.
- set_uuid_in_xml(file_name=None)¶
Add bind to automatically set UUID node in XML.
- property survey¶
Returns an XML XForm survey object.
- property survey_elements¶
Returns an iterator of all survey elements.
- xpath_of_first_geopoint()¶
Returns the abbreviated_xpath of the first field of type geopoint.
- xpaths(prefix='', survey_element=None, result=None, repeat_iterations=4)¶
Return a list of XPaths for this survey that will be used as headers for the csv export.
- class onadata.apps.logger.models.xform.XFormUserObjectPermission(*args, **kwargs)¶
Bases:
UserObjectPermissionBase
Guardian model to create direct foreign keys.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- content_object¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- content_object_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- permission¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- permission_id¶
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- onadata.apps.logger.models.xform.check_version_set(survey)¶
Checks if the version has been set in the xls file and if not adds the default version in this datetime (yyyymmddhhmm) format.
- onadata.apps.logger.models.xform.check_xform_uuid(new_uuid)¶
Checks if a new_uuid has already been used, if it has it raises the exception DuplicateUUIDError.
- onadata.apps.logger.models.xform.clear_project_cache(project_id)¶
Clear project cache
- onadata.apps.logger.models.xform.cmp(x, y)¶
Returns the difference on the comparison of
x
andy
.
- onadata.apps.logger.models.xform.contains_xml_invalid_char(text, invalids=None)¶
Check whether ‘text’ contains ANY invalid xml chars
Return forms shared with a user
- onadata.apps.logger.models.xform.question_types_to_exclude(_type)¶
Returns True if
_type
is in QUESTION_TYPES_TO_EXCLUDE.
- onadata.apps.logger.models.xform.save_project(sender, instance=None, created=False, **kwargs)¶
Update the date_modified field in the XForm’s project.
- onadata.apps.logger.models.xform.update_profile_num_submissions(sender, instance, **kwargs)¶
Reduce the user’s number of submissions on deletions.
- onadata.apps.logger.models.xform.update_xform_uuid(username, id_string, new_uuid)¶
Updates an XForm with the new_uuid.
- onadata.apps.logger.models.xform.upload_to(instance, filename)¶
Returns the path to upload an XLSForm file to.
- onadata.apps.logger.models.xform.xform_post_delete_callback(sender, instance, **kwargs)¶
Clear project cache after deleting an XForm.
onadata.apps.logger.models.xform_version module¶
Module containing the XForm Version model
- class onadata.apps.logger.models.xform_version.XFormVersion(*args, **kwargs)¶
Bases:
Model
XForm version model
The main purpose of this model is to store the various versions of an XForm & link them to their respective xls files on the storage backend for utilization in the future when a user requires the previous XForm versions XML or JSON.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- created_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- created_by_id¶
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- json¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- version¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- xform¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- xform_id¶
- xls¶
The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assign a file object on assignment so you can do:
>>> with open('/path/to/hello.world') as f: ... instance.file = File(f)
- xml¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Module contents¶
Logger models.