akvo.rsr.models.project_editor_validation module

class akvo.rsr.models.project_editor_validation.ProjectEditorValidation(*args, **kwargs)[source]

Bases: Model

A validation is used to set a certain field or combination of fields in the project editor as mandatory, hidden or read only.

The rule field is the key in this model. There are 2 options for this field: - Only a model (e.g. “partnership”) indicating that at least one partnership is mandatory or that partnerships should be hidden in the project editor. - A model and a field (e.g. “budgetitem.other_extra”) indicating that the field is mandatory or that the field should be hidden in the project editor.

Also, any combination of the above options is possible. Separated by ||, which indicates an OR relationship. So “project.title||project.subtitle” with a mandatory action indicates that either the title or the subtitle of a project is mandatory.

ACTIONS = [(1, 'Mandatory'), (2, 'Hidden')]
ACTIONS_LABELS = ['Mandatory', 'Hidden']
ACTIONS_LIST = [1, 2]
exception DoesNotExist

Bases: ObjectDoesNotExist

HIDDEN_ACTION = 2
MANDATORY_ACTION = 1
exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

action

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

get_action_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: action>)
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>
validation

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

validation_set

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.

validation_set_id
class akvo.rsr.models.project_editor_validation.ProjectEditorValidationSet(*args, **kwargs)[source]

Bases: Model

A set of project editor validations, with a name and description. The name and description will be displayed together with the progress bar in the project editor.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

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

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.

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

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 and Topping.pizzas are ManyToManyDescriptor instances.

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

validations

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.