|
@@ -115,32 +115,32 @@ class DjangoMigrationHandler(object):
|
115
|
115
|
#Creating the EmClasses models with document inheritance
|
116
|
116
|
for emclass in classes:
|
117
|
117
|
emclass_fields = {
|
118
|
|
- 'save' : self.get_save_fun(emclass.name, 'class', { 'classtype':emclass.classtype, 'class_name':emclass.name})
|
|
118
|
+ 'save' : self.get_save_fun(emclass.uniq_name, 'class', { 'classtype':emclass.classtype, 'class_name':emclass.uniq_name})
|
119
|
119
|
}
|
120
|
120
|
|
121
|
121
|
#Addding non optionnal fields
|
122
|
122
|
for emfield in emclass.fields():
|
123
|
123
|
if not emfield.optional:
|
124
|
124
|
# !!! Replace with fieldtype 2 django converter
|
125
|
|
- emclass_fields[emfield.name] = models.CharField(max_length=56, default=emfield.name)
|
126
|
|
- print("Model for class %s created with fields : "%emclass.name, emclass_fields)
|
127
|
|
- django_models['classes'][emclass.name] = create_model(emclass.name, emclass_fields, app_label, module_name, parent_class=django_models['doc'])
|
|
125
|
+ emclass_fields[emfield.uniq_name] = models.CharField(max_length=56, default=emfield.uniq_name)
|
|
126
|
+ print("Model for class %s created with fields : "%emclass.uniq_name, emclass_fields)
|
|
127
|
+ django_models['classes'][emclass.uniq_name] = create_model(emclass.uniq_name, emclass_fields, app_label, module_name, parent_class=django_models['doc'])
|
128
|
128
|
|
129
|
129
|
#Creating the EmTypes models with EmClass inherithance
|
130
|
130
|
for emtype in emclass.types():
|
131
|
131
|
emtype_fields = {
|
132
|
|
- 'save': self.get_save_fun(emtype.name, 'type', { 'type_name':emtype.name }),
|
|
132
|
+ 'save': self.get_save_fun(emtype.uniq_name, 'type', { 'type_name':emtype.uniq_name }),
|
133
|
133
|
|
134
|
134
|
}
|
135
|
135
|
#Adding selected optionnal fields
|
136
|
136
|
for emfield in emtype.selected_fields():
|
137
|
|
- emtype_fields[emfield.name] = models.CharField(max_length=56, default=emfield.name)
|
|
137
|
+ emtype_fields[emfield.uniq_name] = models.CharField(max_length=56, default=emfield.uniq_name)
|
138
|
138
|
#Adding superiors foreign key
|
139
|
139
|
for nature, superior in emtype.superiors().items():
|
140
|
|
- emtype_fields[nature] = models.ForeignKey(superior.name, related_name=emtype.name, null=True)
|
|
140
|
+ emtype_fields[nature] = models.ForeignKey(superior.uniq_name, related_name=emtype.uniq_name, null=True)
|
141
|
141
|
|
142
|
|
- print("Model for type %s created with fields : "%emtype.name, emtype_fields)
|
143
|
|
- django_models['types'][emtype.name] = create_model(emtype.name, emtype_fields, app_label, module_name, parent_class=django_models['classes'][emclass.name])
|
|
142
|
+ print("Model for type %s created with fields : "%emtype.uniq_name, emtype_fields)
|
|
143
|
+ django_models['types'][emtype.uniq_name] = create_model(emtype.uniq_name, emtype_fields, app_label, module_name, parent_class=django_models['classes'][emclass.uniq_name])
|
144
|
144
|
|
145
|
145
|
return django_models
|
146
|
146
|
|