mirror of
https://github.com/yweber/lodel2.git
synced 2026-07-05 07:10:48 +02:00
Merge branch 'master' into em_editor
This commit is contained in:
commit
2ab52e5d32
4 changed files with 22 additions and 6 deletions
|
|
@ -91,9 +91,9 @@ class EmBackendGraphviz(EmBackendDummy):
|
|||
for f in [ f for f in c.fields() if f.name not in c.em_class.default_fields_list().keys()]:
|
||||
if f.rel_field_id is None:
|
||||
if f.fieldtype == 'rel2type':
|
||||
rel_node_id = '%s%s'%(EmBackendGraphviz._component_id(c), EmBackendGraphviz._component_id(em.component(f.rel_to_type_id)))
|
||||
rel_node_id = '%s%s%s'%(EmBackendGraphviz._component_id(c), EmBackendGraphviz._component_id(em.component(f.rel_to_type_id)), f.uid)
|
||||
|
||||
rel_node = '\t%s [ label="rel_to_type'%rel_node_id
|
||||
rel_node = '\t%s [ label="rel2type %s'% (rel_node_id, f.name)
|
||||
|
||||
if len(f.rel_to_type_fields()) > 0:
|
||||
#rel_node += '| {'
|
||||
|
|
@ -104,7 +104,8 @@ class EmBackendGraphviz(EmBackendDummy):
|
|||
rel_node += '{ '
|
||||
first = False
|
||||
rel_node += rf.name
|
||||
rel_node += '}" shape="record"]\n'
|
||||
rel_node += '}' if len(f.rel_to_type_fields()) > 0 else ''
|
||||
rel_node += '" shape="record"]\n'
|
||||
|
||||
rel_field += rel_node
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#-*- coding: utf-8 -*-
|
||||
|
||||
from .generic import GenericFieldType
|
||||
from .generic import SingleValueFieldType
|
||||
|
||||
|
||||
class EmFieldType(GenericFieldType):
|
||||
class EmFieldType(SingleValueFieldType):
|
||||
|
||||
help = 'A basic boolean field'
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ class EmFieldType(SingleValueFieldType):
|
|||
## @brief A char field
|
||||
# @brief max_length int : The maximum length of this field
|
||||
def __init__(self, max_length=64, **kwargs):
|
||||
self.max_length = max_length
|
||||
self.max_length = int(max_length)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
|
|
|||
15
EditorialModel/fieldtypes/dictionary.py
Normal file
15
EditorialModel/fieldtypes/dictionary.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#-*- coding: utf-8 -*-
|
||||
|
||||
from .generic import MultiValueFieldType
|
||||
from . import char
|
||||
|
||||
|
||||
class EmFieldType(MultiValueFieldType):
|
||||
|
||||
help = 'Fieldtype designed to handle translations'
|
||||
|
||||
def __init__(self, value_max_length = 64, **args):
|
||||
args['keyname'] = 'key'
|
||||
args['key_fieldtype'] = char.EmFieldType(max_length = 4)
|
||||
args['value_fieldtype'] = char.EmFieldType(value_max_length)
|
||||
super().__init__(**args)
|
||||
Loading…
Add table
Add a link
Reference in a new issue