1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2025-11-14 18:09:17 +01:00

New graphviz backend + some methods added to some components

This commit is contained in:
Yann 2015-09-17 11:59:59 +02:00
commit 4c0b8d3279
5 changed files with 142 additions and 4 deletions

View file

@ -48,6 +48,14 @@ class EmField(EmComponent):
super(EmField, self).__init__(model=model, uid=uid, name=name, string=string, help_text=help_text, date_update=date_update, date_create=date_create, rank=rank)
## @brief Return the list of relation fields for a rel_to_type
# @return None if the field is not a rel_to_type else return a list of EmField
def rel_to_type_fields(self):
if not self.rel_to_type_id:
return None
return [ f for f in self.model.components(EmField) if f.rel_field_id == self.uid ]
## Check if the EmField is valid
# @return True if valid False if not
def check(self):
@ -77,4 +85,4 @@ class EmField(EmComponent):
if self.fieldtype == 'boolean' and ('nullable' in self.options and self.options['nullable'] == 1):
return models.NullBooleanField(**self.options)
return self.fieldtypes[self.fieldtype](**self.options)
return self.fieldtypes[self.fieldtype](**self.options)