akvo.rsr.models.partnership module
- class akvo.rsr.models.partnership.Partnership(id, organisation, project, iati_organisation_role, is_secondary_reporter, funding_amount, partner_type_extra, iati_activity_id, internal_id, iati_url, related_activity_id)[source]
Bases:
Model
- AKVO_SPONSOR_PARTNER = 100
- ALLIANCE_PARTNER = 'alliance'
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- EXTENDING_PARTNER = 'extending'
- FIELD_PARTNER = 'field'
- FUNDING_PARTNER = 'funding'
- IATI_ACCOUNTABLE_PARTNER = 2
- IATI_EXTENDING_PARTNER = 3
- IATI_FUNDING_PARTNER = 1
- IATI_IMPLEMENTING_PARTNER = 4
- IATI_REPORTING_ORGANISATION = 101
- IATI_ROLES = [(1, 'Funding partner'), (2, 'Accountable partner'), (3, 'Extending partner'), (4, 'Implementing partner'), (100, 'Sponsor partner'), (101, 'Reporting organisation')]
- IATI_ROLE_LABELS = ['Funding partner', 'Accountable partner', 'Extending partner', 'Implementing partner', 'Sponsor partner', 'Reporting organisation']
- IATI_ROLE_LIST = [1, 2, 3, 4, 100, 101]
- KNOWLEDGE_PARTNER = 'knowledge'
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- NETWORK_PARTNER = 'network'
- PARTNER_LABELS = ['Implementing partner', 'Funding partner', 'Sponsor partner', 'Accountable partner', 'Extending partner']
- PARTNER_TYPES = [('field', 'Implementing partner'), ('funding', 'Funding partner'), ('sponsor', 'Sponsor partner'), ('support', 'Accountable partner'), ('extending', 'Extending partner')]
- PARTNER_TYPES_TO_ROLES_MAP = {'field': 4, 'funding': 1, 'sponsor': 100, 'support': 2}
- PARTNER_TYPE_EXTRAS = [('alliance', 'Alliance'), ('knowledge', 'Knowledge'), ('network', 'Network')]
- PARTNER_TYPE_EXTRAS_LIST = ('alliance', 'knowledge', 'network')
- PARTNER_TYPE_EXTRA_LABELS = ('Alliance', 'Knowledge', 'Network')
- PARTNER_TYPE_LIST = ['field', 'funding', 'sponsor', 'support', 'extending']
- ROLES_TO_PARTNER_TYPES_MAP = {1: 'funding', 2: 'support', 3: 'extending', 4: 'field', 100: 'sponsor', 101: ''}
- SPONSOR_PARTNER = 'sponsor'
- SUPPORT_PARTNER = 'support'
- 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.
- funding_amount
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- funding_amount_with_currency()[source]
Returns the funding amount, prepended by the project’s currency.
- get_iati_organisation_role_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: iati_organisation_role>)
- get_partner_type_extra_display(*, field=<akvo.rsr.fields.ValidXMLCharField: partner_type_extra>)
- iati_activity_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- iati_organisation_role
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- iati_url
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.
- internal_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_secondary_reporter
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>
- organisation
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.
- organisation_id
- partner_type_extra
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- 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
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- 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.
- akvo.rsr.models.partnership.invalidate_caches(sender: Type[Partnership], instance: Partnership | None = None, **kwargs)[source]
Ensure related cache keys are removed to prevent access to old data