From fe18c28cd47a14f4c10a91c667fd4876ae1875d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexa=20Valentov=C3=A1?= <git@imaniti.org> Date: Mon, 16 Dec 2024 18:54:09 +0100 Subject: [PATCH 1/2] fix file sending, update limits --- main/forms.py | 2 +- main/models.py | 6 +++++- main/templates/main/main_career_page.html | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/main/forms.py b/main/forms.py index 55bb85f2..d3f378f4 100644 --- a/main/forms.py +++ b/main/forms.py @@ -19,7 +19,7 @@ class MultipleFileField(forms.FileField): kwargs.setdefault("widget", MultipleFileInput()) super().__init__(*args, **kwargs) - TOTAL_MAX_FILE_SIZE = 10 * 1024 * 1024 # 10 MB + TOTAL_MAX_FILE_SIZE = 5 * 1024 * 1024 # 5 MB def clean(self, data, initial=None): single_file_clean = super().clean diff --git a/main/models.py b/main/models.py index 91500894..2735af40 100644 --- a/main/models.py +++ b/main/models.py @@ -557,7 +557,7 @@ CV, motivační dopis a ostatní soubory jsou v přílohách. Názvy souborů: Ostatní soubory: {other_files_names} -Při otevírání souborů buďte opatrní, virový sken neproběhl! +Při otevírání souborů buďte opatrní, virový proběhl, ale nemusí být přesný! """ ), # From email @@ -566,11 +566,14 @@ Při otevírání souborů buďte opatrní, virový sken neproběhl! self.recipient_emails.split(","), ) + form.cleaned_data["cv_file"].seek(0) email.attach( form.cleaned_data["cv_file"].name, form.cleaned_data["cv_file"].read(), form.cleaned_data["cv_file"].content_type, ) + + form.cleaned_data["cover_letter_file"].seek(0) email.attach( form.cleaned_data["cover_letter_file"].name, form.cleaned_data["cover_letter_file"].read(), @@ -578,6 +581,7 @@ Při otevírání souborů buďte opatrní, virový sken neproběhl! ) for file in form.cleaned_data["other_files"]: + file.seek(0) email.attach(file.name, file.read(), file.content_type) sent_successfully = email.send() diff --git a/main/templates/main/main_career_page.html b/main/templates/main/main_career_page.html index be1372ec..4e0f7f9f 100644 --- a/main/templates/main/main_career_page.html +++ b/main/templates/main/main_career_page.html @@ -110,7 +110,7 @@ {{ form.other_files }} <small class="text-grey-300"> - (Max. 5 MB na jeden soubor, 10 MB celkem) + (Max. 5 MB na jeden soubor, 5 MB celkem) </small> </div> </section> -- GitLab From be55a3df407dd2074f2c1c7864b2bfd7e4fca888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexa=20Valentov=C3=A1?= <git@imaniti.org> Date: Mon, 16 Dec 2024 18:55:04 +0100 Subject: [PATCH 2/2] run hooks --- .isort.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.isort.cfg b/.isort.cfg index 86199fdc..286307ab 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -3,4 +3,4 @@ line_length = 88 multi_line_output = 3 include_trailing_comma = true -known_third_party = PyPDF2,arrow,bleach,bs4,captcha,celery,dateutil,django,django_ratelimit,environ,faker,fastjsonschema,gql,httplib2,icalendar,instaloader,markdown,modelcluster,nh3,pirates,pytest,pytz,requests,sentry_sdk,taggit,wagtail,wagtailmetadata,weasyprint,willow,yaml +known_third_party = PyPDF2,arrow,bleach,bs4,captcha,celery,clamd,dateutil,django,django_ratelimit,environ,faker,fastjsonschema,gql,httplib2,icalendar,instaloader,markdown,modelcluster,nh3,pirates,pytest,pytz,requests,sentry_sdk,taggit,wagtail,wagtailmetadata,weasyprint,willow,yaml -- GitLab