akvo.rsr.models.result.indicator_period_data module

class akvo.rsr.models.result.indicator_period_data.IndicatorPeriodData(*args, **kwargs)[source]

Bases: TimestampsMixin, IndicatorUpdateMixin, Model

Model for adding data to an indicator period.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

STATUSES = [('D', 'draft'), ('P', 'pending approval'), ('R', 'return for revision'), ('A', 'approved')]
STATUSES_LABELS_LIST = ['draft', 'pending approval', 'return for revision', 'approved']
STATUS_APPROVED = 'approved'
STATUS_APPROVED_CODE = 'A'
STATUS_CODES_LIST = ['D', 'P', 'R', 'A']
STATUS_DRAFT = 'draft'
STATUS_DRAFT_CODE = 'D'
STATUS_PENDING = 'pending approval'
STATUS_PENDING_CODE = 'P'
STATUS_REVISION = 'return for revision'
STATUS_REVISION_CODE = 'R'
UPDATE_METHODS = (('W', 'web'), ('M', 'mobile'))
approved_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 a ForwardManyToOneDescriptor instance.

approved_by_id
clean()[source]

Perform several checks before we can actually save the update data.

comments

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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

delete(*args, **kwargs)[source]
denominator

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

disaggregations

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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

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)
property file_url

Returns the full URL of the file.

get_status_display(*, field=<akvo.rsr.fields.ValidXMLCharField: status>)
get_update_method_display(*, field=<akvo.rsr.fields.ValidXMLCharField: update_method>)
classmethod get_user_viewable_updates(queryset, user)[source]
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

indicatorperioddatafile_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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

indicatorperioddataphoto_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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

last_modified_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

narrative

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

numerator

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>
period

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 a ForwardManyToOneDescriptor instance.

period_id
photo

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

property photo_url

Returns the full URL of the photo.

project_relation = 'results__indicators__periods__data__in'
review_note

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(recalculate=True, *args, **kwargs)[source]

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.

score_index

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

score_indices

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.

property status_display

Returns the display of the status.

text

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

update_method

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 a ForwardManyToOneDescriptor instance.

user_id
value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class akvo.rsr.models.result.indicator_period_data.IndicatorPeriodDataFile(id, update, file)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

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)
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>
update

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 a ForwardManyToOneDescriptor instance.

update_id
class akvo.rsr.models.result.indicator_period_data.IndicatorPeriodDataPhoto(id, update, photo)[source]

Bases: Model

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.

objects = <django.db.models.manager.Manager object>
photo

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

update

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 a ForwardManyToOneDescriptor instance.

update_id
akvo.rsr.models.result.indicator_period_data.set_qualitative_narrative(sender, **kwargs)[source]

Update the narrative field of a qualitative indicator on updates.

akvo.rsr.models.result.indicator_period_data.update_file_path(instance, file_name)[source]
akvo.rsr.models.result.indicator_period_data.update_image_path(instance, file_name)[source]