Merge branch 'development' into feature/multi-tenant
This commit is contained in:
@@ -39,7 +39,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class APIDeletedDocumentListView(generics.ListAPIView):
|
||||
"""
|
||||
Returns a list of all the deleted documents.
|
||||
Returns a list of all the trashed documents.
|
||||
"""
|
||||
|
||||
filter_backends = (MayanObjectPermissionsFilter,)
|
||||
@@ -51,7 +51,7 @@ class APIDeletedDocumentListView(generics.ListAPIView):
|
||||
|
||||
class APIDeletedDocumentView(generics.RetrieveDestroyAPIView):
|
||||
"""
|
||||
Returns the selected deleted document details.
|
||||
Returns the selected trashed document details.
|
||||
"""
|
||||
|
||||
mayan_object_permissions = {
|
||||
@@ -63,7 +63,7 @@ class APIDeletedDocumentView(generics.RetrieveDestroyAPIView):
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
"""
|
||||
Delete the selected document.
|
||||
Delete the trashed document.
|
||||
"""
|
||||
|
||||
return super(APIDeletedDocumentView, self).delete(*args, **kwargs)
|
||||
@@ -71,7 +71,7 @@ class APIDeletedDocumentView(generics.RetrieveDestroyAPIView):
|
||||
|
||||
class APIDeletedDocumentRestoreView(generics.GenericAPIView):
|
||||
"""
|
||||
Restore a deleted document.
|
||||
Restore a trashed document.
|
||||
"""
|
||||
|
||||
mayan_object_permissions = {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.apps import apps
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .literals import DEFAULT_DOCUMENT_TYPE_LABEL
|
||||
from .signals import post_initial_document_type
|
||||
|
||||
|
||||
def create_default_document_type(sender, **kwargs):
|
||||
@@ -10,4 +12,9 @@ def create_default_document_type(sender, **kwargs):
|
||||
)
|
||||
|
||||
if not DocumentType.objects.count():
|
||||
DocumentType.objects.create(label=_('Default'))
|
||||
document_type = DocumentType.objects.create(
|
||||
label=DEFAULT_DOCUMENT_TYPE_LABEL
|
||||
)
|
||||
post_initial_document_type.send(
|
||||
sender=DocumentType, instance=document_type
|
||||
)
|
||||
|
||||
@@ -11,6 +11,7 @@ DELETE_STALE_STUBS_INTERVAL = 60 * 10 # 10 minutes
|
||||
DEFAULT_DELETE_PERIOD = 30
|
||||
DEFAULT_DELETE_TIME_UNIT = TIME_DELTA_UNIT_DAYS
|
||||
DEFAULT_ZIP_FILENAME = 'document_bundle.zip'
|
||||
DEFAULT_DOCUMENT_TYPE_LABEL = _('Default')
|
||||
DOCUMENT_IMAGE_TASK_TIMEOUT = 20
|
||||
STUB_EXPIRATION_INTERVAL = 60 * 60 * 24 # 24 hours
|
||||
UPDATE_PAGE_COUNT_RETRY_DELAY = 10
|
||||
|
||||
Binary file not shown.
@@ -10,7 +10,7 @@ msgstr ""
|
||||
"Project-Id-Version: Mayan EDMS\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-04-27 14:11-0400\n"
|
||||
"PO-Revision-Date: 2016-04-27 18:22+0000\n"
|
||||
"PO-Revision-Date: 2016-05-09 01:41+0000\n"
|
||||
"Last-Translator: Roberto Rosario\n"
|
||||
"Language-Team: Spanish (http://www.transifex.com/rosarior/mayan-edms/language/es/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -458,7 +458,7 @@ msgstr "Versión de documento"
|
||||
|
||||
#: models.py:632
|
||||
msgid "Quick label"
|
||||
msgstr ""
|
||||
msgstr "Etiqueta rapida"
|
||||
|
||||
#: models.py:650
|
||||
msgid "Page number"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('documents', '0033_auto_20160325_0052'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='document',
|
||||
name='in_trash',
|
||||
field=models.BooleanField(default=False, verbose_name='In trash?', db_index=True, editable=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='document',
|
||||
name='is_stub',
|
||||
field=models.BooleanField(default=True, editable=False, help_text='A document stub is a document with an entry on the database but no file uploaded. This could be an interrupted upload or a deferred upload via the API.', verbose_name='Is stub?', db_index=True),
|
||||
),
|
||||
]
|
||||
@@ -176,7 +176,8 @@ class Document(models.Model):
|
||||
verbose_name=_('Language')
|
||||
)
|
||||
in_trash = models.BooleanField(
|
||||
default=False, editable=False, verbose_name=_('In trash?')
|
||||
db_index=True, default=False, editable=False,
|
||||
verbose_name=_('In trash?')
|
||||
)
|
||||
# TODO: set editable to False
|
||||
deleted_date_time = models.DateTimeField(
|
||||
@@ -184,10 +185,11 @@ class Document(models.Model):
|
||||
verbose_name=_('Date and time trashed')
|
||||
)
|
||||
is_stub = models.BooleanField(
|
||||
default=True, editable=False, help_text=_(
|
||||
db_index=True, default=True, editable=False, help_text=_(
|
||||
'A document stub is a document with an entry on the database but '
|
||||
'no file uploaded. This could be an interrupted upload or a '
|
||||
'deferred upload via the API.'), verbose_name=_('Is stub?')
|
||||
'deferred upload via the API.'
|
||||
), verbose_name=_('Is stub?')
|
||||
)
|
||||
|
||||
objects = DocumentManager()
|
||||
|
||||
@@ -7,3 +7,6 @@ post_document_type_change = Signal(
|
||||
providing_args=('instance',), use_caching=True
|
||||
)
|
||||
post_document_created = Signal(providing_args=('instance',), use_caching=True)
|
||||
post_initial_document_type = Signal(
|
||||
providing_args=('instance',), use_caching=True
|
||||
)
|
||||
|
||||
@@ -173,7 +173,7 @@ class DocumentAPITestCase(APITestCase):
|
||||
self.assertEqual(Document.trash.count(), 1)
|
||||
|
||||
self.client.delete(
|
||||
reverse('rest_api:deleteddocument-detail', args=(document.pk,))
|
||||
reverse('rest_api:trasheddocument-detail', args=(document.pk,))
|
||||
)
|
||||
|
||||
self.assertEqual(Document.trash.count(), 0)
|
||||
@@ -187,7 +187,7 @@ class DocumentAPITestCase(APITestCase):
|
||||
document.delete()
|
||||
|
||||
self.client.post(
|
||||
reverse('rest_api:deleteddocument-restore', args=(document.pk,))
|
||||
reverse('rest_api:trasheddocument-restore', args=(document.pk,))
|
||||
)
|
||||
|
||||
self.assertEqual(Document.trash.count(), 0)
|
||||
|
||||
@@ -243,16 +243,16 @@ urlpatterns = patterns(
|
||||
api_urls = patterns(
|
||||
'',
|
||||
url(
|
||||
r'^deleted_documents/$', APIDeletedDocumentListView.as_view(),
|
||||
name='deleteddocument-list'
|
||||
r'^trashed_documents/$', APIDeletedDocumentListView.as_view(),
|
||||
name='trasheddocument-list'
|
||||
),
|
||||
url(
|
||||
r'^deleted_documents/(?P<pk>[0-9]+)/$',
|
||||
APIDeletedDocumentView.as_view(), name='deleteddocument-detail'
|
||||
r'^trashed_documents/(?P<pk>[0-9]+)/$',
|
||||
APIDeletedDocumentView.as_view(), name='trasheddocument-detail'
|
||||
),
|
||||
url(
|
||||
r'^deleted_documents/(?P<pk>[0-9]+)/restore/$',
|
||||
APIDeletedDocumentRestoreView.as_view(), name='deleteddocument-restore'
|
||||
r'^trashed_documents/(?P<pk>[0-9]+)/restore/$',
|
||||
APIDeletedDocumentRestoreView.as_view(), name='trasheddocument-restore'
|
||||
),
|
||||
url(r'^documents/$', APIDocumentListView.as_view(), name='document-list'),
|
||||
url(
|
||||
|
||||
@@ -85,7 +85,7 @@ class DocumentListView(SingleObjectListView):
|
||||
object_permission = permission_document_view
|
||||
|
||||
def get_document_queryset(self):
|
||||
return Document.objects.filter(document_type__organization__id=settings.ORGANIZATION_ID)
|
||||
return Document.objects.filter(document_type__organization__id=settings.ORGANIZATION_ID).defer('description', 'uuid', 'date_added', 'language', 'in_trash', 'deleted_date_time').all()
|
||||
|
||||
def get_queryset(self):
|
||||
self.queryset = self.get_document_queryset().filter(is_stub=False)
|
||||
|
||||
Reference in New Issue
Block a user