mirror of
https://github.com/daniviga/django-ram.git
synced 2025-12-05 13:38:43 +01:00
Restore missing DeduplicatedStorage for documents
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from ram.utils import git_suffix
|
from ram.utils import git_suffix
|
||||||
|
|
||||||
__version__ = "0.17.13"
|
__version__ = "0.17.14"
|
||||||
__version__ += git_suffix(__file__)
|
__version__ += git_suffix(__file__)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class Document(models.Model):
|
|||||||
description = models.CharField(max_length=128, blank=True)
|
description = models.CharField(max_length=128, blank=True)
|
||||||
file = models.FileField(
|
file = models.FileField(
|
||||||
upload_to="files/",
|
upload_to="files/",
|
||||||
|
storage=DeduplicatedStorage,
|
||||||
)
|
)
|
||||||
creation_time = models.DateTimeField(auto_now_add=True)
|
creation_time = models.DateTimeField(auto_now_add=True)
|
||||||
updated_time = models.DateTimeField(auto_now=True)
|
updated_time = models.DateTimeField(auto_now=True)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class DeduplicatedStorage(FileSystemStorage):
|
|||||||
"""
|
"""
|
||||||
A derived FileSystemStorage class that compares already existing files
|
A derived FileSystemStorage class that compares already existing files
|
||||||
(with the same name) with new uploaded ones and stores new file only if
|
(with the same name) with new uploaded ones and stores new file only if
|
||||||
sha256 hash on is content is different
|
sha256 hash on its content is different
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def save(self, name, content, max_length=None):
|
def save(self, name, content, max_length=None):
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# Generated by Django 5.2.7 on 2025-10-28 21:17
|
||||||
|
|
||||||
|
import ram.utils
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("repository", "0002_invoicedocument_remove_basebookdocument_book_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="bookdocument",
|
||||||
|
name="file",
|
||||||
|
field=models.FileField(
|
||||||
|
storage=ram.utils.DeduplicatedStorage, upload_to="files/"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="catalogdocument",
|
||||||
|
name="file",
|
||||||
|
field=models.FileField(
|
||||||
|
storage=ram.utils.DeduplicatedStorage, upload_to="files/"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="decoderdocument",
|
||||||
|
name="file",
|
||||||
|
field=models.FileField(
|
||||||
|
storage=ram.utils.DeduplicatedStorage, upload_to="files/"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="genericdocument",
|
||||||
|
name="file",
|
||||||
|
field=models.FileField(
|
||||||
|
storage=ram.utils.DeduplicatedStorage, upload_to="files/"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rollingstockdocument",
|
||||||
|
name="file",
|
||||||
|
field=models.FileField(
|
||||||
|
storage=ram.utils.DeduplicatedStorage, upload_to="files/"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user