Compare commits
2 Commits
master
...
testato-co
| Author | SHA1 | Date |
|---|---|---|
|
|
8185c7edf6 | |
|
|
51862ad3ed |
|
|
@ -109,12 +109,16 @@ class ImportMixin(admin.ModelAdmin):
|
||||||
allowed_extensions=[".gif", ".jpg", ".jpeg", ".png", ".svg"]
|
allowed_extensions=[".gif", ".jpg", ".jpeg", ".png", ".svg"]
|
||||||
try:
|
try:
|
||||||
tema_json = [s for s in os.listdir(f'{tempdir}/{lst[0]}') if '.json' in s][0]
|
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]
|
logo = [s for s in os.listdir(f'{tempdir}/{lst[0]}/logo') if any(ele in s for ele in allowed_extensions)]
|
||||||
favicon = [s for s in os.listdir(f'{tempdir}/{lst[0]}/favicon') if any(ele in s for ele in allowed_extensions)][0]
|
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:
|
with open(f'{tempdir}/{lst[0]}/{tema_json}', 'r') as temporary_file:
|
||||||
result = json.loads(temporary_file.read())
|
result = json.loads(temporary_file.read())
|
||||||
|
if logo:
|
||||||
with open(f'{tempdir}/{lst[0]}/logo/{logo}', 'rb') as temporary_file:
|
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)
|
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:
|
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)
|
default_storage.save(f"admin-interface/favicon/{temporary_file.name.split('/')[-1]}", temporary_file)
|
||||||
skip_result = False
|
skip_result = False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue