|
@@ -2,6 +2,7 @@
|
2
|
2
|
|
3
|
3
|
from EditorialModel.components import EmComponent, EmComponentNotExistError
|
4
|
4
|
from Lodel.utils.mlstring import MlString
|
|
5
|
+from sqlalchemy import Column, INTEGER, BOOLEAN
|
5
|
6
|
|
6
|
7
|
def get_field_type(name):
|
7
|
8
|
class_name = 'EmField_' + name
|
|
@@ -34,6 +35,9 @@ class EmField_integer(EmFieldType):
|
34
|
35
|
def sql_column(self):
|
35
|
36
|
return "int(11) NOT NULL"
|
36
|
37
|
|
|
38
|
+ def sqlalchemy_args(self):
|
|
39
|
+ # TODO Ajouter la prise en charge de la taille max
|
|
40
|
+ return {'type_': INTEGER, 'nullable': False}
|
37
|
41
|
|
38
|
42
|
class EmField_boolean(EmFieldType):
|
39
|
43
|
|
|
@@ -55,6 +59,8 @@ class EmField_boolean(EmFieldType):
|
55
|
59
|
def sql_column(self):
|
56
|
60
|
return "tinyint(1) DEFAULT NULL"
|
57
|
61
|
|
|
62
|
+ def sqlalchemy_args(self):
|
|
63
|
+ return {'type_': BOOLEAN, 'nullable': True, 'default': None}
|
58
|
64
|
|
59
|
65
|
class EmField_char(EmFieldType):
|
60
|
66
|
|
|
@@ -76,6 +82,9 @@ class EmField_char(EmFieldType):
|
76
|
82
|
def sql_column(self):
|
77
|
83
|
return "varchar(250) DEFAULT NULL"
|
78
|
84
|
|
|
85
|
+ def sqlalchemy_args(self):
|
|
86
|
+ return {'type_': VARCHAR(250), 'nullable': True, 'default': None}
|
|
87
|
+
|
79
|
88
|
|
80
|
89
|
class EmField_mlstring(EmFieldType):
|
81
|
90
|
|
|
@@ -93,3 +102,6 @@ class EmField_mlstring(EmFieldType):
|
93
|
102
|
|
94
|
103
|
def sql_column(self):
|
95
|
104
|
return "varchar(250) DEFAULT NULL"
|
|
105
|
+
|
|
106
|
+ def sqlalchemy_args(self):
|
|
107
|
+ return {'type_': VARCHAR(250), 'nullable': True, 'default': None}
|