This commit is contained in:
Cayo Puigdefabregas 2023-12-15 17:52:23 +01:00
parent 45f30f3664
commit e551d2aadc
1 changed files with 12 additions and 2 deletions

View File

@ -443,8 +443,18 @@ class Schemas(models.Model):
return {} return {}
return json.loads(self.data) return json.loads(self.data)
def name(self): def name(self, request=None):
return self.get_schema.get('name', '') names = {}
for name in self.get_schema.get('name', []):
lang = name.get('lang')
if 'ca' in lang:
lang = 'ca'
names[lang]= name.get('value')
if request and request.LANGUAGE_CODE in names.keys():
return names[request.LANGUAGE_CODE]
return names[settings.LANGUAGE_CODE]
def description(self): def description(self):
return self.get_schema.get('description', '') return self.get_schema.get('description', '')