swh.deposit.models module#
- class swh.deposit.models.Dbversion(*args, **kwargs)[source]#
Bases:
Model
Db version
- version#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- release#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- description#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- objects = <django.db.models.manager.Manager object>#
- swh.deposit.models.DEPOSIT_STATUS = [('partial', 'partial'), ('expired', 'expired'), ('deposited', 'deposited'), ('verified', 'verified'), ('rejected', 'rejected'), ('loading', 'loading'), ('done', 'done'), ('failed', 'failed')]#
Possible status and the detailed meaning.
- class swh.deposit.models.DepositClient(*args, **kwargs)[source]#
Bases:
User
Deposit client
- collections#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.contrib.auth.models.UserManager object>#
- provider_url#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- domain#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist#
Bases:
DoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- deposit_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.
- user_ptr#
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- user_ptr_id#
- class swh.deposit.models.Deposit(*args, **kwargs)[source]#
Bases:
Model
Deposit reception table
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- reception_date#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- complete_date#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- collection#
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.
- external_id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- origin_url#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- client#
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.
- swhid#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- swhid_context#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- status#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- status_detail#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- parent#
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.
- check_task_id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- load_task_id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- type#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- set_raw_metadata(raw_metadata: str) None [source]#
Set the metadata raw out of a ‘metadata’ typed deposit request. This is specifically used during listing.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- client_id#
- collection_id#
- deposit_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.
- depositrequest_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.
- get_next_by_reception_date(*, field=<django.db.models.fields.DateTimeField: reception_date>, is_next=True, **kwargs)#
- get_previous_by_reception_date(*, field=<django.db.models.fields.DateTimeField: reception_date>, is_next=False, **kwargs)#
- get_status_display(*, field=<django.db.models.fields.TextField: status>)#
- get_type_display(*, field=<django.db.models.fields.CharField: type>)#
- objects = <django.db.models.manager.Manager object>#
- parent_id#
- swh.deposit.models.client_directory_path(instance: DepositRequest, filename: str) str [source]#
- Callable to determine the upload archive path. This defaults to
MEDIA_ROOT/client_<user_id>/%Y%m%d-%H%M%S.%f/<filename>.
The format “%Y%m%d-%H%M%S.%f” is the reception date of the associated deposit formatted using strftime.
- Parameters:
instance – DepositRequest concerned by the upload
filename – Filename of the uploaded file
- Returns:
The upload archive path.
- class swh.deposit.models.DepositRequest(*args, **kwargs)[source]#
Bases:
Model
Deposit request associated to one deposit.
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deposit#
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#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- metadata#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- raw_metadata#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- archive#
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)
- type#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- deposit_id#
- get_next_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=True, **kwargs)#
- get_previous_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=False, **kwargs)#
- get_type_display(*, field=<django.db.models.fields.CharField: type>)#
- objects = <django.db.models.manager.Manager object>#
- class swh.deposit.models.DepositCollection(id, name)[source]#
Bases:
Model
- 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.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- deposit_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.
- objects = <django.db.models.manager.Manager object>#