|
@@ -42,13 +42,6 @@ class _LeRelation(lecrud._LeCrud):
|
42
|
42
|
rel_ft.update(cls._rel_attr_fieldtypes)
|
43
|
43
|
return rel_ft
|
44
|
44
|
|
45
|
|
- ## @brief instanciate the relevant lodel object using a dict of datas
|
46
|
|
- @classmethod
|
47
|
|
- def object_from_data(cls, datas):
|
48
|
|
- if 'nature' in datas:
|
49
|
|
- return cls.name2class('LeHierarch')(**datas)
|
50
|
|
- return "To implement !"
|
51
|
|
-
|
52
|
45
|
@classmethod
|
53
|
46
|
def _prepare_relational_fields(cls, field):
|
54
|
47
|
return lecrud.LeApiQueryError("Relational field '%s' given but %s doesn't is not a LeObject" % (field,
|
|
@@ -146,6 +139,11 @@ class _LeHierarch(_LeRelation):
|
146
|
139
|
def delete(self):
|
147
|
140
|
lecrud._LeCrud._delete(self)
|
148
|
141
|
|
|
142
|
+ ## @brief instanciate the relevant lodel object using a dict of datas
|
|
143
|
+ @classmethod
|
|
144
|
+ def object_from_data(cls, datas):
|
|
145
|
+ return cls.name2class('LeHierarch')(**datas)
|
|
146
|
+
|
149
|
147
|
## @brief Abstract class to handle rel2type relations
|
150
|
148
|
class _LeRel2Type(_LeRelation):
|
151
|
149
|
## @brief Stores the list of fieldtypes handling relations attributes
|
|
@@ -183,3 +181,14 @@ class _LeRel2Type(_LeRelation):
|
183
|
181
|
|
184
|
182
|
return "Rel_%s2%s" % (supname, subname)
|
185
|
183
|
|
|
184
|
+ ## @brief instanciate the relevant lodel object using a dict of datas
|
|
185
|
+ @classmethod
|
|
186
|
+ def object_from_data(cls, datas):
|
|
187
|
+ le_object = cls.name2class('LeObject')
|
|
188
|
+ class_name = le_object._me_uid[datas['class_id']].__name__
|
|
189
|
+ type_name = le_object._me_uid[datas['type_id']].__name__
|
|
190
|
+ relation_classname = lecrud._LeCrud.name2rel2type(class_name, type_name)
|
|
191
|
+
|
|
192
|
+ del(datas['class_id'], datas['type_id'])
|
|
193
|
+
|
|
194
|
+ return cls.name2class(relation_classname)(**datas)
|