From 01d9d0d1899462e4a280df78b06b0c893fe2a602 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 15 Jan 2024 19:10:55 +0100 Subject: [PATCH] fix initial_datas --- idhub/management/commands/initial_datas.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/idhub/management/commands/initial_datas.py b/idhub/management/commands/initial_datas.py index 034bc68..e4e6e4d 100644 --- a/idhub/management/commands/initial_datas.py +++ b/idhub/management/commands/initial_datas.py @@ -82,10 +82,18 @@ class Command(BaseCommand): try: ldata = json.loads(data) assert credtools.validate_schema(ldata) - name = ldata.get('name') - assert name + dname = ldata.get('name') + assert dname except Exception: 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) def open_file(self, file_name):