4
4
5
5
from django .core .exceptions import ValidationError
6
6
from django .db import models
7
+ from django .utils .encoding import python_2_unicode_compatible
7
8
8
9
from formidable import constants
9
10
from formidable .register import FieldSerializerRegister
10
11
11
12
13
+ @python_2_unicode_compatible
12
14
class Formidable (models .Model ):
13
15
14
16
label = models .CharField (max_length = 256 )
@@ -58,6 +60,7 @@ def __str__(self):
58
60
return '{formidable.label}' .format (formidable = self )
59
61
60
62
63
+ @python_2_unicode_compatible
61
64
class Field (models .Model ):
62
65
63
66
class Meta :
@@ -87,6 +90,7 @@ def __str__(self):
87
90
return '{field.label}' .format (field = self )
88
91
89
92
93
+ @python_2_unicode_compatible
90
94
class Default (models .Model ):
91
95
92
96
value = models .CharField (max_length = 256 )
@@ -96,6 +100,7 @@ def __str__(self):
96
100
return '{default.value}' .format (default = self )
97
101
98
102
103
+ @python_2_unicode_compatible
99
104
class Item (models .Model ):
100
105
field = models .ForeignKey (Field , related_name = 'items' )
101
106
value = models .CharField (max_length = 256 )
@@ -107,6 +112,7 @@ def __str__(self):
107
112
return '{item.label}: {item.value}' .format (item = self )
108
113
109
114
115
+ @python_2_unicode_compatible
110
116
class Access (models .Model ):
111
117
112
118
class Meta :
@@ -124,6 +130,7 @@ def __str__(self):
124
130
access = self )
125
131
126
132
133
+ @python_2_unicode_compatible
127
134
class Validation (models .Model ):
128
135
field = models .ForeignKey (Field , related_name = 'validations' )
129
136
value = models .CharField (max_length = 256 )
@@ -135,6 +142,7 @@ def __str__(self):
135
142
validation = self )
136
143
137
144
145
+ @python_2_unicode_compatible
138
146
class Preset (models .Model ):
139
147
form = models .ForeignKey (Formidable , related_name = 'presets' )
140
148
slug = models .CharField (max_length = 128 )
@@ -144,6 +152,7 @@ def __str__(self):
144
152
return '{preset.slug}' .format (preset = self )
145
153
146
154
155
+ @python_2_unicode_compatible
147
156
class PresetArg (models .Model ):
148
157
preset = models .ForeignKey (Preset , related_name = 'arguments' )
149
158
slug = models .CharField (max_length = 128 )
0 commit comments