Skip to content
Snippets Groups Projects
Commit fe18c28c authored by Alexa Valentová's avatar Alexa Valentová
Browse files

fix file sending, update limits

parent 00812366
Branches
No related tags found
2 merge requests!1208Release,!1202Feat/fix octo import
...@@ -19,7 +19,7 @@ class MultipleFileField(forms.FileField): ...@@ -19,7 +19,7 @@ class MultipleFileField(forms.FileField):
kwargs.setdefault("widget", MultipleFileInput()) kwargs.setdefault("widget", MultipleFileInput())
super().__init__(*args, **kwargs) 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): def clean(self, data, initial=None):
single_file_clean = super().clean single_file_clean = super().clean
......
...@@ -557,7 +557,7 @@ CV, motivační dopis a ostatní soubory jsou v přílohách. Názvy souborů: ...@@ -557,7 +557,7 @@ CV, motivační dopis a ostatní soubory jsou v přílohách. Názvy souborů:
Ostatní soubory: Ostatní soubory:
{other_files_names} {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 # From email
...@@ -566,11 +566,14 @@ Při otevírání souborů buďte opatrní, virový sken neproběhl! ...@@ -566,11 +566,14 @@ Při otevírání souborů buďte opatrní, virový sken neproběhl!
self.recipient_emails.split(","), self.recipient_emails.split(","),
) )
form.cleaned_data["cv_file"].seek(0)
email.attach( email.attach(
form.cleaned_data["cv_file"].name, form.cleaned_data["cv_file"].name,
form.cleaned_data["cv_file"].read(), form.cleaned_data["cv_file"].read(),
form.cleaned_data["cv_file"].content_type, form.cleaned_data["cv_file"].content_type,
) )
form.cleaned_data["cover_letter_file"].seek(0)
email.attach( email.attach(
form.cleaned_data["cover_letter_file"].name, form.cleaned_data["cover_letter_file"].name,
form.cleaned_data["cover_letter_file"].read(), form.cleaned_data["cover_letter_file"].read(),
...@@ -578,6 +581,7 @@ Při otevírání souborů buďte opatrní, virový sken neproběhl! ...@@ -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"]: for file in form.cleaned_data["other_files"]:
file.seek(0)
email.attach(file.name, file.read(), file.content_type) email.attach(file.name, file.read(), file.content_type)
sent_successfully = email.send() sent_successfully = email.send()
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
{{ form.other_files }} {{ form.other_files }}
<small class="text-grey-300"> <small class="text-grey-300">
(Max. 5 MB na jeden soubor, 10 MB celkem) (Max. 5 MB na jeden soubor, 5 MB celkem)
</small> </small>
</div> </div>
</section> </section>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment