fix name
This commit is contained in:
parent
45f30f3664
commit
e551d2aadc
|
@ -443,9 +443,19 @@ 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', '')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue