|
@@ -17,7 +17,7 @@ from EditorialModel.classtypes import EmClassType
|
17
|
17
|
class EmClass(EmComponent):
|
18
|
18
|
|
19
|
19
|
ranked_in = 'classtype'
|
20
|
|
-
|
|
20
|
+
|
21
|
21
|
## EmClass instanciation
|
22
|
22
|
# @todo Classtype initialisation and test is not good EmClassType should give an answer or something like that
|
23
|
23
|
# @todo defines types check for icon and sortcolumn
|
|
@@ -39,16 +39,15 @@ class EmClass(EmComponent):
|
39
|
39
|
if fname not in [f.name for f in self.fields()]:
|
40
|
40
|
self.model.add_default_class_fields(self.uid)
|
41
|
41
|
super(EmClass, self).check()
|
42
|
|
-
|
|
42
|
+
|
43
|
43
|
## @brief Return the default fields list for this EmClass
|
44
|
44
|
# @return a dict with key = fieldname and value is a dict to pass to the EditorialModel::model::Model::creat_component() method
|
45
|
45
|
def default_fields_list(self):
|
46
|
46
|
ctype = EditorialModel.classtypes.EmClassType.get(self.classtype)
|
47
|
47
|
res = ctype['default_fields']
|
48
|
|
- for k,v in EditorialModel.classtypes.common_fields.items():
|
|
48
|
+ for k, v in EditorialModel.classtypes.common_fields.items():
|
49
|
49
|
res[k] = copy.copy(v)
|
50
|
50
|
return res
|
51
|
|
-
|
52
|
51
|
|
53
|
52
|
## @brief Delete a class if it's ''empty''
|
54
|
53
|
# If a class has no fieldgroups delete it
|
|
@@ -73,11 +72,11 @@ class EmClass(EmComponent):
|
73
|
72
|
|
74
|
73
|
## Retrieve list of fields
|
75
|
74
|
# @return fields [EmField]:
|
76
|
|
- def fields(self, relational = True):
|
|
75
|
+ def fields(self, relational=True):
|
77
|
76
|
if relational:
|
78
|
|
- return [ f for f in self.model.components('EmField') if f.class_id == self.uid]
|
|
77
|
+ return [f for f in self.model.components('EmField') if f.class_id == self.uid]
|
79
|
78
|
else:
|
80
|
|
- return [ f for f in self.model.components('EmField') if f.class_id == self.uid and f.fieldtype != 'rel2type' and f.rel_field_id is None]
|
|
79
|
+ return [f for f in self.model.components('EmField') if f.class_id == self.uid and f.fieldtype != 'rel2type' and f.rel_field_id is None]
|
81
|
80
|
|
82
|
81
|
## Retrieve list of type of this class
|
83
|
82
|
# @return types [EditorialModel.types.EmType]:
|