Compare commits
4
Commits
97e1a2b315
...
bdlaser
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8185c7edf6 | ||
|
|
51862ad3ed | ||
|
|
0eed8c8679 | ||
|
|
d74fcd4001 |
@@ -109,14 +109,18 @@ class ImportMixin(admin.ModelAdmin):
|
||||
allowed_extensions=[".gif", ".jpg", ".jpeg", ".png", ".svg"]
|
||||
try:
|
||||
tema_json = [s for s in os.listdir(f'{tempdir}/{lst[0]}') if '.json' in s][0]
|
||||
logo = [s for s in os.listdir(f'{tempdir}/{lst[0]}/logo') if any(ele in s for ele in allowed_extensions)][0]
|
||||
favicon = [s for s in os.listdir(f'{tempdir}/{lst[0]}/favicon') if any(ele in s for ele in allowed_extensions)][0]
|
||||
logo = [s for s in os.listdir(f'{tempdir}/{lst[0]}/logo') if any(ele in s for ele in allowed_extensions)]
|
||||
logo = logo[0] if logo else None
|
||||
favicon = [s for s in os.listdir(f'{tempdir}/{lst[0]}/favicon') if any(ele in s for ele in allowed_extensions)]
|
||||
favicon = favicon[0] if favicon else None
|
||||
with open(f'{tempdir}/{lst[0]}/{tema_json}', 'r') as temporary_file:
|
||||
result = json.loads(temporary_file.read())
|
||||
with open(f'{tempdir}/{lst[0]}/logo/{logo}', 'rb') as temporary_file:
|
||||
default_storage.save(f"admin-interface/logo/{temporary_file.name.split('/')[-1]}", temporary_file)
|
||||
with open(f'{tempdir}/{lst[0]}/favicon/{favicon}', 'rb') as temporary_file:
|
||||
default_storage.save(f"admin-interface/favicon/{temporary_file.name.split('/')[-1]}", temporary_file)
|
||||
if logo:
|
||||
with open(f'{tempdir}/{lst[0]}/logo/{logo}', 'rb') as temporary_file:
|
||||
default_storage.save(f"admin-interface/logo/{temporary_file.name.split('/')[-1]}", temporary_file)
|
||||
if favicon:
|
||||
with open(f'{tempdir}/{lst[0]}/favicon/{favicon}', 'rb') as temporary_file:
|
||||
default_storage.save(f"admin-interface/favicon/{temporary_file.name.split('/')[-1]}", temporary_file)
|
||||
skip_result = False
|
||||
except FileNotFoundError as e:
|
||||
messages.error(request, 'Struttura del file .zip errata.')
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
}
|
||||
windowRef = {
|
||||
name: widgetName,
|
||||
location: windowRef.location,
|
||||
close: function() {
|
||||
openerRef.dismissRelatedObjectModal();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__version__ = "0.19.7"
|
||||
__version__ = "0.19.8"
|
||||
|
||||
Reference in New Issue
Block a user