akvo.rsr.models.result.indicator_period module

class akvo.rsr.models.result.indicator_period.IndicatorPeriod(id, indicator, parent_period, locked, period_start, period_end, target_value, target_comment, target_score, actual_value, actual_comment, numerator, denominator, narrative, score_index, score_indices, label)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

actual_comment

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

actual_locations

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.

actual_value

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

actual_value_is_decimal()[source]
adjacent_period(next_period=True)[source]

Returns the next or previous indicator period, if we can find one with a start date, and we have a start date ourselves.

:param next_period; Boolean indicating either the next (True) or previous (False) period.

aggregation_jobs

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.

property approved_updates
can_save_update(update_id=None)[source]

Return True if an update can be created/updated on the indicator period.

If no update_id is passed, we check if a new update can be created. If an update_id is passed, we verify that the update can be modified.

Non percentage indicators can have multiple updates. If the indicator is a percentage indicator, we check that no other update is present, other than the one currently being created or changed.

child_aggregation_jobs

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.

child_periods

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.

clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

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

denominator

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

disaggregation_targets

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.

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.

get_root_period()[source]
id

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

indicator

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.

indicator_id
is_calculated()[source]

When a period has got indicator updates, we consider the actual value to be a ‘calculated’ value, meaning that it’s not possible to update the actual value directly. Only through indicator updates.

is_child_period()[source]

Indicates whether this period is linked to a parent period

label

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.

label_id
locked

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>
parent_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.

parent_period_id
property percent_accomplishment

Return the percentage completed for this indicator period. If not possible to convert the values to numbers, return None.

property percent_accomplishment_100

Similar to the percent_accomplishment property. However, it won’t return any number bigger than 100.

period_end

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

period_start

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

periodactualvalue_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.

perioddisaggregation_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.

property project
project_relation = 'results__indicators__periods__in'
save(*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.

target_comment

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

target_locations

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.

target_score

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

target_value

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

update_actual_comment(save=True)[source]

Set the actual comment to the text of the latest approved update.

:param save; Boolean, save period if True :return Actual comment of period

update_score(save=True)[source]

Set the score of the period to the score of the latest approved update.