fix initial_datas
This commit is contained in:
parent
225c2a3712
commit
01d9d0d189
|
@ -82,10 +82,18 @@ class Command(BaseCommand):
|
||||||
try:
|
try:
|
||||||
ldata = json.loads(data)
|
ldata = json.loads(data)
|
||||||
assert credtools.validate_schema(ldata)
|
assert credtools.validate_schema(ldata)
|
||||||
name = ldata.get('name')
|
dname = ldata.get('name')
|
||||||
assert name
|
assert dname
|
||||||
except Exception:
|
except Exception:
|
||||||
return
|
return
|
||||||
|
name = ''
|
||||||
|
try:
|
||||||
|
for x in dname:
|
||||||
|
if settings.LANGUAGE_CODE in x['lang']:
|
||||||
|
name = x.get('value', '')
|
||||||
|
except Exception:
|
||||||
|
return
|
||||||
|
|
||||||
Schemas.objects.create(file_schema=file_name, data=data, type=name)
|
Schemas.objects.create(file_schema=file_name, data=data, type=name)
|
||||||
|
|
||||||
def open_file(self, file_name):
|
def open_file(self, file_name):
|
||||||
|
|
Loading…
Reference in New Issue