Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/models.py
# Copyright (C) 2017-2018 The Software Heritage developers | # Copyright (C) 2017-2018 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
# Generated from: | # Generated from: | ||||
# cd swh_deposit && \ | # cd swh_deposit && \ | ||||
# python3 -m manage inspectdb | # python3 -m manage inspectdb | ||||
from django.contrib.postgres.fields import JSONField, ArrayField | from django.contrib.postgres.fields import JSONField, ArrayField | ||||
from django.contrib.auth.models import User, UserManager | from django.contrib.auth.models import User, UserManager | ||||
from django.db import models | from django.db import models | ||||
from django.utils.timezone import now | from django.utils.timezone import now | ||||
from .config import DEPOSIT_STATUS_VERIFIED, DEPOSIT_STATUS_DEPOSITED | from .config import ( | ||||
from .config import DEPOSIT_STATUS_PARTIAL, DEPOSIT_STATUS_LOAD_SUCCESS | DEPOSIT_STATUS_VERIFIED, DEPOSIT_STATUS_DEPOSITED, DEPOSIT_STATUS_PARTIAL, | ||||
from .config import DEPOSIT_STATUS_LOAD_FAILURE, DEPOSIT_STATUS_REJECTED | DEPOSIT_STATUS_LOAD_SUCCESS, DEPOSIT_STATUS_LOAD_FAILURE, | ||||
DEPOSIT_STATUS_REJECTED | |||||
) | |||||
class Dbversion(models.Model): | class Dbversion(models.Model): | ||||
"""Db version | """Db version | ||||
""" | """ | ||||
version = models.IntegerField(primary_key=True) | version = models.IntegerField(primary_key=True) | ||||
release = models.DateTimeField(default=now, null=True) | release = models.DateTimeField(default=now, null=True) | ||||
Show All 11 Lines | |||||
"""Possible status""" | """Possible status""" | ||||
DEPOSIT_STATUS = [ | DEPOSIT_STATUS = [ | ||||
(DEPOSIT_STATUS_PARTIAL, DEPOSIT_STATUS_PARTIAL), | (DEPOSIT_STATUS_PARTIAL, DEPOSIT_STATUS_PARTIAL), | ||||
('expired', 'expired'), | ('expired', 'expired'), | ||||
(DEPOSIT_STATUS_DEPOSITED, DEPOSIT_STATUS_DEPOSITED), | (DEPOSIT_STATUS_DEPOSITED, DEPOSIT_STATUS_DEPOSITED), | ||||
(DEPOSIT_STATUS_VERIFIED, DEPOSIT_STATUS_VERIFIED), | (DEPOSIT_STATUS_VERIFIED, DEPOSIT_STATUS_VERIFIED), | ||||
('rejected', 'rejected'), | (DEPOSIT_STATUS_REJECTED, DEPOSIT_STATUS_REJECTED), | ||||
('loading', 'loading'), | ('loading', 'loading'), | ||||
(DEPOSIT_STATUS_LOAD_SUCCESS, DEPOSIT_STATUS_LOAD_SUCCESS), | (DEPOSIT_STATUS_LOAD_SUCCESS, DEPOSIT_STATUS_LOAD_SUCCESS), | ||||
(DEPOSIT_STATUS_LOAD_FAILURE, DEPOSIT_STATUS_LOAD_FAILURE), | (DEPOSIT_STATUS_LOAD_FAILURE, DEPOSIT_STATUS_LOAD_FAILURE), | ||||
] | ] | ||||
"""Possible status and the detailed meaning.""" | """Possible status and the detailed meaning.""" | ||||
DEPOSIT_STATUS_DETAIL = { | DEPOSIT_STATUS_DETAIL = { | ||||
DEPOSIT_STATUS_PARTIAL: 'Deposit is partially received. To finalize it, ' | DEPOSIT_STATUS_PARTIAL: 'Deposit is partially received. To finalize it, ' | ||||
'In-Progress header should be false', | 'In-Progress header should be false', | ||||
'expired': 'Deposit has been there too long and is now ' | 'expired': 'Deposit has been there too long and is now ' | ||||
'deemed ready to be garbage collected', | 'deemed ready to be garbage collected', | ||||
DEPOSIT_STATUS_DEPOSITED: 'Deposit is ready for additional checks ' | DEPOSIT_STATUS_DEPOSITED: 'Deposit is ready for additional checks ' | ||||
'(tarball ok, metadata, etc...)', | '(tarball ok, metadata, etc...)', | ||||
DEPOSIT_STATUS_VERIFIED: 'Deposit is fully received, checked, and ' | DEPOSIT_STATUS_VERIFIED: 'Deposit is fully received, checked, and ' | ||||
'ready for loading', | 'ready for loading', | ||||
'rejected': 'Deposit failed the checks', | DEPOSIT_STATUS_REJECTED: 'Deposit failed the checks', | ||||
'loading': "Loading is ongoing on swh's side", | 'loading': "Loading is ongoing on swh's side", | ||||
DEPOSIT_STATUS_LOAD_SUCCESS: 'The deposit has been successfully ' | DEPOSIT_STATUS_LOAD_SUCCESS: 'The deposit has been successfully ' | ||||
'loaded into the Software Heritage archive', | 'loaded into the Software Heritage archive', | ||||
DEPOSIT_STATUS_LOAD_FAILURE: 'The deposit loading into the ' | DEPOSIT_STATUS_LOAD_FAILURE: 'The deposit loading into the ' | ||||
'Software Heritage archive failed', | 'Software Heritage archive failed', | ||||
} | } | ||||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |