apps.core.models
- class apps.core.models.Task(*args, **kwargs)[source]
Bases:
Model
A model for tracking tasks.
- name
The name of the task.
- Type:
str
- task_ingestor
The ingestor responsible for the task.
- Type:
str
- datetime
The date and time the task was created.
- Type:
datetime
- status
The current status of the task. Allowed values are ‘pending’, ‘processing’, ‘processed’, and ‘failed’.
- Type:
str
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- TASK_STATUS_CHOICES = (('pending', 'Pending'), ('processing', 'Processing'), ('processed', 'Processed'), ('failed', 'Failed'))
- TASK_STATUS_FAILED = 'failed'
- TASK_STATUS_PENDING = 'pending'
- TASK_STATUS_PROCESSED = 'processed'
- TASK_STATUS_PROCESSING = 'processing'
- complete_processing()[source]
Transition the task from ‘processing’ to ‘processed’ and delete the record.
- datetime
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- fail_processing()[source]
Transition the task from ‘processing’ to ‘failed’.
- get_next_by_datetime(*, field=<django.db.models.fields.DateTimeField: datetime>, is_next=True, **kwargs)
- get_previous_by_datetime(*, field=<django.db.models.fields.DateTimeField: datetime>, is_next=False, **kwargs)
- get_status_display(*, field=<django.db.models.fields.CharField: status>)
- 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>
- save(*args, **kwargs)[source]
Save the task
- start_processing()[source]
Transition the task from ‘pending’ to ‘processing’.
- status
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- task_ingestor
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class apps.core.models.TimestampedModel(*args, **kwargs)[source]
Bases:
TrackableModel
- Abstract model that builds on the functionality of
TrackableModel by adding extra fields for timestamping.
- date_added
The timestamp when the model instance was first added.
- Type:
DateTimeField
- date_updated
The timestamp of the most recent update to the model instance.
- Type:
DateTimeField
- date_deleted
The timestamp of when the model instance was deleted (if applicable).
- Type:
DateTimeField
- class Meta[source]
Bases:
object
- abstract = False
- created_by
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.
- date_added
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_deleted
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_updated
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
- get_next_by_date_added(*, field=<django.db.models.fields.DateTimeField: date_added>, is_next=True, **kwargs)
- get_next_by_date_updated(*, field=<django.db.models.fields.DateTimeField: date_updated>, is_next=True, **kwargs)
- get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
- get_previous_by_date_added(*, field=<django.db.models.fields.DateTimeField: date_added>, is_next=False, **kwargs)
- get_previous_by_date_updated(*, field=<django.db.models.fields.DateTimeField: date_updated>, is_next=False, **kwargs)
- get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
- updated_by
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.
- class apps.core.models.TrackableModel(*args, **kwargs)[source]
Bases:
Model
Abstract model that provides fields to automatically track changes and keep a record of who made them.
- created_at
The timestamp when the model instance was first created.
- Type:
DateTimeField
- updated_at
The timestamp of the most recent update to the model instance.
- Type:
DateTimeField
- created_by
The user who created the model instance.
- Type:
ForeignKey
- updated_by
The user who last updated the model instance.
- Type:
ForeignKey
- history
A JSON field that stores a complete history of changes to the model instance, including timestamps and the user who made each change.
- Type:
JSONField
- class Meta[source]
Bases:
object
- abstract = False
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_by
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.
- created_by_id
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
- get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
- get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
- updated_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated_by
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.
- updated_by_id