akvo.rsr.models.project_hierarchy module
- class akvo.rsr.models.project_hierarchy.ProjectHierarchy(*args, **kwargs)[source]
Bases:
Model
The actual “Program” with a project hierarchy.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- property descendants
The entire tree in a list. No order is guaranteed
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_master
Used when an organisation has one program under which they would like to create subprograms
- max_depth
TODO: It is unclear why this field currently exists
- objects = <django.db.models.manager.Manager object>
- property organisation
The reporting organisation of the tree
- partnersite_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.
- property project_count
The number of children without counting the root project
- property project_ids
- project_relation = 'projecthierarchy__in'
- root_project
The root of the program It can be used to create subprograms / a program tree
- root_project_id