bartTC / django-attachments

A generic Django application to attach Files (Attachments) to any model.
BSD 3-Clause "New" or "Revised" License
296 stars 90 forks source link

Respect FILE_UPLOAD_MAX_SIZE setting #43

Closed atodorov closed 6 years ago

atodorov commented 6 years ago

This PR implements max file size validation.

@bartTC in case of error I'm seeing the following message "File exceeds maximum size of 1.2В MB"

Notice the "B" char after "1.2". I'm not sure where this comes from, I think it is from form.as_p. filesizeformat in this case happily returns "1.2 MB".

Note2: I don't have any tests and also not sure if it will work on older Django but works for me locally.

atodorov commented 6 years ago

@bartTC ping. Please give me a general review on this PR before I spend more time on it writing tests.

bartTC commented 6 years ago

@atodorov I think thiis fine and a good approach, thanks for tackling this.

atodorov commented 6 years ago

@bartTC rebased and ready to go. Can you release a new version on PyPI after you merge this. I really need the max file size and delete functionality for Kiwi TCMS.

bartTC commented 6 years ago

Sure, its here https://pypi.python.org/pypi/django-attachments

Thank you for your comprehensive updates.