From 9933432ec70d9408e95e022a37755c3f8187996a Mon Sep 17 00:00:00 2001 From: Gabriel Getzie Date: Wed, 9 Oct 2024 08:25:26 -0500 Subject: [PATCH] change document file_size to PositiveBigIntegerField (#12397) Fixes #12396 --- CHANGELOG.txt | 1 + CONTRIBUTORS.md | 1 + docs/releases/6.3.md | 1 + .../0014_alter_document_file_size.py | 18 ++++++++++++ wagtail/documents/models.py | 2 +- ...alter_customdocument_file_size_and_more.py | 28 +++++++++++++++++++ 6 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 wagtail/documents/migrations/0014_alter_document_file_size.py create mode 100644 wagtail/test/testapp/migrations/0042_alter_customdocument_file_size_and_more.py diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ca4c560a53..f7bad3ca88 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -33,6 +33,7 @@ Changelog * Fix: Always show the minimap toggle button (Albina Starykova) * Fix: Ensure that dropdown button toggles show with a border in high contrast mode (Ishwari8104, LB (Ben) Johnston) * Fix: Update email notification header to the new logo design (rahulsamant37) + * Fix: Change `file_size` field on document model to avoid artificial 2Gb limit (Gabriel Getzie) * Docs: Upgrade Sphinx to 7.3 (Matt Westcott) * Docs: Document how to customize date/time format settings (Vince Salvino) * Docs: Create a new documentation section for deployment and move fly.io deployment from the tutorial to this section (Vince Salvino) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 49918c4d6b..6785158602 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -837,6 +837,7 @@ * Matthew Scouten * Ishwari8104 * rahulsamant37 +* Gabriel Getzie ## Translators diff --git a/docs/releases/6.3.md b/docs/releases/6.3.md index 713254354c..0d0bc54ac4 100644 --- a/docs/releases/6.3.md +++ b/docs/releases/6.3.md @@ -51,6 +51,7 @@ This release adds formal support for Django 5.1. * Remove polleverywhere oEmbed provider as it this application longer supports oEmbed (Matthew Scouten) * Ensure that dropdown button toggles show with a border in high contrast mode (Ishwari8104, LB (Ben) Johnston) * Update email notification header to the new logo design (rahulsamant37) + * Change `file_size` field on document model to avoid artificial 2Gb limit (Gabriel Getzie) ### Documentation diff --git a/wagtail/documents/migrations/0014_alter_document_file_size.py b/wagtail/documents/migrations/0014_alter_document_file_size.py new file mode 100644 index 0000000000..1e1f828fd5 --- /dev/null +++ b/wagtail/documents/migrations/0014_alter_document_file_size.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.9 on 2024-10-09 16:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtaildocs", "0013_delete_uploadeddocument"), + ] + + operations = [ + migrations.AlterField( + model_name="document", + name="file_size", + field=models.PositiveBigIntegerField(editable=False, null=True), + ), + ] diff --git a/wagtail/documents/models.py b/wagtail/documents/models.py index e84936f371..e4ed73ae4b 100644 --- a/wagtail/documents/models.py +++ b/wagtail/documents/models.py @@ -38,7 +38,7 @@ class AbstractDocument(CollectionMember, index.Indexed, models.Model): tags = TaggableManager(help_text=None, blank=True, verbose_name=_("tags")) - file_size = models.PositiveIntegerField(null=True, editable=False) + file_size = models.PositiveBigIntegerField(null=True, editable=False) # A SHA-1 hash of the file contents file_hash = models.CharField(max_length=40, blank=True, editable=False) diff --git a/wagtail/test/testapp/migrations/0042_alter_customdocument_file_size_and_more.py b/wagtail/test/testapp/migrations/0042_alter_customdocument_file_size_and_more.py new file mode 100644 index 0000000000..e2d6a91fa0 --- /dev/null +++ b/wagtail/test/testapp/migrations/0042_alter_customdocument_file_size_and_more.py @@ -0,0 +1,28 @@ +# Generated by Django 5.0.9 on 2024-10-09 16:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("tests", "0041_alter_jsonstreammodel_options"), + ] + + operations = [ + migrations.AlterField( + model_name="customdocument", + name="file_size", + field=models.PositiveBigIntegerField(editable=False, null=True), + ), + migrations.AlterField( + model_name="customdocumentwithauthor", + name="file_size", + field=models.PositiveBigIntegerField(editable=False, null=True), + ), + migrations.AlterField( + model_name="customrestaurantdocument", + name="file_size", + field=models.PositiveBigIntegerField(editable=False, null=True), + ), + ]