Wrap storages

Wrap storages directly connected to file model fields to avoid
Django triggering a migration change when an attribute of the
storage is changed, like the location.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-28 00:22:49 -04:00
parent f96057b0fd
commit 442bf5dc4b
9 changed files with 87 additions and 9 deletions

View File

@@ -13,7 +13,7 @@ from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from .managers import ErrorLogEntryManager, UserLocaleProfileManager
from .storages import storage_sharedupload
from .storages import storage_sharedupload_wrapper
logger = logging.getLogger(__name__)
@@ -58,7 +58,7 @@ class SharedUploadedFile(models.Model):
that runs out of process.
"""
file = models.FileField(
storage=storage_sharedupload, upload_to=upload_to,
storage=storage_sharedupload_wrapper, upload_to=upload_to,
verbose_name=_('File')
)
filename = models.CharField(max_length=255, verbose_name=_('Filename'))