From e3c4a8102a08cdad763945fff741ce2fcf2124f8 Mon Sep 17 00:00:00 2001 From: Haydn Greatnews Date: Thu, 25 Jul 2024 10:26:55 +1200 Subject: [PATCH] Remove download file-size limits --- cdhweb/pages/blocks/download_block.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/cdhweb/pages/blocks/download_block.py b/cdhweb/pages/blocks/download_block.py index 6c1093475..d965a364f 100644 --- a/cdhweb/pages/blocks/download_block.py +++ b/cdhweb/pages/blocks/download_block.py @@ -1,20 +1,7 @@ -from django.core.exceptions import ValidationError from wagtail import blocks from wagtail.documents.blocks import DocumentChooserBlock -class LimitedDocumentChooserBlock(DocumentChooserBlock): - def clean(self, value): - document = super().clean(value) - max_file_size = 5 * 1024 * 1024 # 5 MB - - # Check if the file size exceeds the limit - if document.file_size > max_file_size: - raise ValidationError("File size exceeds the limit of 5 MB.") - - return document - - class FileBlock(blocks.StructBlock): title = blocks.CharBlock( help_text="Title for this file as you'd like it to be seen by the public. It will fall back to document title if this field is empty", @@ -22,7 +9,7 @@ class FileBlock(blocks.StructBlock): required=False, ) - file = LimitedDocumentChooserBlock( + file = DocumentChooserBlock( verbose_name="Document", required=True, )