deposit.models module

class deposit.models.DepositPreferences(*args, **kwargs)[source]

Bases: django.db.models.base.Model

This is an abstract base model to be subclassed by repositories. It stores the preferences one user might have concerning a particular repository, such as default affiliation for HAL, default license, or things we want to fill in automatically for them.

Parameters:
  • user_id (ForeignKey) – User
  • repository_id (ForeignKey) – Repository
class Meta[source]
abstract = False
get_form()[source]

This method should return the

classmethod get_form_class()[source]

This method should be reimplemented to return the form class to edit these deposit preferences. This is expected to be a ModelForm that get_form will be able to initialize with values from an existing instance.

repository

The repository for which these preferences apply

repository_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

The user for which these preferences are stored

user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class deposit.models.DepositRecord(*args, **kwargs)[source]

Bases: django.db.models.base.Model

This model stores the results of a deposit initiated by the user, regardless of its success. Protocol implementers should not have to deal with this model directly, their interfaces should only manipulate DepositResult objects and DepositError exceptions, depending on the success of the deposit.

Parameters:
  • id (AutoField) – Id
  • paper_id (ForeignKey) – Paper
  • user_id (ForeignKey) – User
  • repository_id (ForeignKey) – Repository
  • request (TextField) – Request
  • identifier (CharField) – Identifier
  • oairecord_id (ForeignKey) – Oairecord
  • date (DateTimeField) – Date
  • upload_type (CharField) – Upload type
  • status (CharField) – Status
  • additional_info (JSONField) – Additional info
  • file_id (ForeignKey) – File
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

additional_info

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

file

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

file_id

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_date(*moreargs, **morekwargs)
get_previous_by_date(*moreargs, **morekwargs)
get_status_display(*moreargs, **morekwargs)
get_upload_type_display(*moreargs, **morekwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

identifier

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

oairecord

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

oairecord_id

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>
paper

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

paper_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

repository

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

repository_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

request

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.

upload_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class deposit.models.Repository(*args, **kwargs)[source]

Bases: django.db.models.base.Model, caching.base.CachingMixin

This model stores the parameters for a particular repository.

The name, description, url and logo fields are used in the user interface to present the repository.

The protocol field should contain the name of a subclass of RepositoryProtocol which implements the API supported by the repository. Note that this subclass needs to be registered in the protocol_registry in order to be available at runtime.

The api_key, username, password and endpoint are parameters used by the protocol implementation to perform the deposit.

Parameters:
  • id (AutoField) – Id
  • name (CharField) – Name
  • description (TextField) – Description
  • url (URLField) – Url
  • logo (ImageField) – Logo
  • protocol (CharField) – Protocol
  • oaisource_id (ForeignKey) – Oaisource
  • username (CharField) – Username
  • password (CharField) – Password
  • api_key (CharField) – Api key
  • endpoint (CharField) – Endpoint
  • enabled (BooleanField) – Enabled
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

api_key

An API key required by the protocol

depositrecord_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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

description

Description

enabled

Setting this to false forbids any deposit in this repository

endpoint

The API’s endpoint

get_implementation()[source]

Creates an instance of the class corresponding to the protocol identifier, bound with this repository. If the class cannot be found in the protocol_registry, None is returned.

Returns:the class corresponding to the value of the protocol field.
haldepositpreferences_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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_used_by

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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Logo

name

Name

oaisource

The source with which the OaiRecords associated with the deposits are created

oaisource_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <deposit.models.RepositoryManager object>
osfdepositpreferences_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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

password

The password for that account

preferred_by

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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

protocol

The identifier of the interface (protocol) used for that repository

protocol_for_deposit(paper, user)[source]

Returns an instance of the protocol initialized for the given paper and user, if initialization succeeded.

Returns:an instance of the protocol implementation, or None if the instance failed to initialize with the given paper and user.
url

URL of the homepage (ex: http://arxiv.org/ )

username

The identifier of the account under which papers should be deposited

class deposit.models.RepositoryManager[source]

Bases: caching.base.CachingManager

class deposit.models.UserPreferences(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Stores the user’s global preferences, not the ones specific to a particular repository.

Parameters:
  • id (AutoField) – Id
  • user_id (OneToOneField) – User
  • email (EmailField) – We will use this email address to notify you when your deposits are accepted.
  • preferred_repository_id (ForeignKey) – This repository will be used by default for your deposits.
  • last_repository_id (ForeignKey) – Last repository
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

email

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod get_by_user(user)[source]

Returns a UserPreferences instance for a particular user

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_repository

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

last_repository_id

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>
preferred_repository

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

preferred_repository_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.