akvo.rsr.models.iati_export module
- class akvo.rsr.models.iati_export.IatiExport(id, created_at, last_modified_at, reporting_organisation, user, version, status, iati_file, latest)[source]
Bases:
TimestampsMixin
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- STATUS_CANCELLED = 4
- STATUS_CODE = {1: 'pending', 2: 'in progress', 3: 'completed', 4: 'cancelled'}
- STATUS_COMPLETED = 3
- STATUS_IN_PROGRESS = 2
- STATUS_PENDING = 1
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- iati_activity_exports
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.
- iati_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.
- property is_latest
- 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.
- latest
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>
- processed_projects()[source]
Find the number of processed projects of this IATI export. Generally, for completed exports, this number will be the same as the number of total projects.
- 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- reporting_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.
- reporting_organisation_id
- status
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- update_iati_file(iati_file)[source]
Update the IATI file of this IATI export.
:param iati_file; File object
- update_status(status_code)[source]
Update the status of this IATI export.
:param status_code; Integer in self.STATUS_CODE keys
- 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 aForwardManyToOneDescriptor
instance.
- user_id
- version
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.