Skip to content

Commit 48cfcaa

Browse files
committed
rel message in new and zip file size
1 parent 972eca2 commit 48cfcaa

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

etsd/msgs/forms.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ def clean(self):
8686

8787
kind = self.cleaned_data.get("kind")
8888
rel_message = self.cleaned_data.get("rel_message")
89-
if kind == "NEW" and rel_message:
89+
'''if kind == "NEW" and rel_message:
9090
self.add_error(
9191
"rel_message",
9292
_("You cannot add a related message when message kind is New!"),
93-
)
93+
)'''
9494
if kind != "NEW" and not rel_message:
9595
self.add_error(
9696
"rel_message",

etsd/msgs/templates/msgs/message_add_data.html

+11-2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@
3838
{% block extra_script_no_compress %}
3939
{% get_setting_value "MAX_FILE_SIZE" as MAX_FILE_SIZE %}
4040
{% get_setting_value "MAX_FILE_SIZE_STR" as MAX_FILE_SIZE_STR %}
41+
{% get_setting_value "MAX_ZIP_SIZE" as MAX_ZIP_SIZE %}
42+
{% get_setting_value "MAX_ZIP_SIZE_STR" as MAX_ZIP_SIZE_STR %}
4143
<script>
4244
const requestPath = '{{ request.path }}'
4345
const maxFileSize = {{ MAX_FILE_SIZE }};
4446
const maxFileSizeStr = '{{ MAX_FILE_SIZE_STR }}';
47+
const maxZipSize = {{ MAX_ZIP_SIZE }};
48+
const maxZipSizeStr = '{{ MAX_ZIP_SIZE_STR }}';
4549
</script>
4650

4751
<script>
@@ -76,8 +80,13 @@
7680
document.getElementById('file').addEventListener("change", function() {
7781
if (this.files && this.files[0]) {
7882
let theFile = this.files[0];
79-
80-
if (theFile.size > maxFileSize) {
83+
84+
if (getFileExt(theFile.name) == 'zip' && theFile.size > maxZipSize ) {
85+
bootstrap5Alert({'message': gettext("Zip file can be up to ") + maxZipSizeStr , 'title': gettext("ERROR")})
86+
document.getElementById('file').value=''
87+
return
88+
}
89+
else if (theFile.size > maxFileSize && getFileExt(theFile.name) != 'zip') {
8190
bootstrap5Alert({'message': gettext("File can be up to ") + maxFileSizeStr, 'title': gettext("ERROR")})
8291
document.getElementById('file').value=''
8392
return

etsd/settings/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,7 @@
198198

199199
MAX_FILE_SIZE = 2 * 1024 * 1024 # 2MB
200200
MAX_FILE_SIZE_STR = "2MB"
201+
MAX_ZIP_SIZE = 8 * 1024 * 1024 # 8MB
202+
MAX_ZIP_SIZE_STR = "8MB"
201203

202204
CHECK_LDAP_USERS = True

rsp.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
set WERKZEUG_DEBUG_PIN=off
2-
python manage.py runserver_plus
2+
python manage.py runserver_plus --keep-meta-shutdown

0 commit comments

Comments
 (0)