prieto 8 years ago
parent
commit
e4214a1705

+ 4
- 0
lodel/leapi/datahandlers/base_classes.py View File

62
     @classmethod
62
     @classmethod
63
     def is_reference(cls):
63
     def is_reference(cls):
64
         return issubclass(cls, Reference)
64
         return issubclass(cls, Reference)
65
+    
66
+    @classmethod
67
+    def is_singlereference(cls):
68
+        return issubclass(cls, SingleRef)
65
 
69
 
66
     def is_primary_key(self):
70
     def is_primary_key(self):
67
         return self.primary_key
71
         return self.primary_key

+ 11
- 4
plugins/webui/interface/controllers/admin.py View File

145
             # both are hidden in the form, to identify the object here
145
             # both are hidden in the form, to identify the object here
146
              if in_put != 'classname' and in_value != '':
146
              if in_put != 'classname' and in_value != '':
147
                 dhl = target_leo.data_handler(in_put[12:])
147
                 dhl = target_leo.data_handler(in_put[12:])
148
-                if dhl.is_reference() and in_value != '':
149
-                    logger.warning("Provisoire pour faire les tests, à fixer")
148
+                if dhl.is_singlereference():
149
+                    in_value=int(in_value)
150
+                elif dhl.is_reference() and in_value != '':
151
+                    logger.info(in_value)
150
                     in_value.replace(" ","")
152
                     in_value.replace(" ","")
151
                     in_value=in_value.split(',')
153
                     in_value=in_value.split(',')
154
+                    in_value=list(in_value)
155
+                    l=list()
152
                     for i in in_value:
156
                     for i in in_value:
153
                         l.append(int(i))
157
                         l.append(int(i))
154
-                    in_value=list(l)
158
+                    in_value=l
159
+
155
                 fields[in_put[12:]] = in_value
160
                 fields[in_put[12:]] = in_value
156
-                
161
+                if in_value == '':
162
+                    fields[in_put[12:]] = None
163
+                    
157
         # Insertion in the database of the values corresponding to a new object
164
         # Insertion in the database of the values corresponding to a new object
158
         new_uid = target_leo.insert(fields)
165
         new_uid = target_leo.insert(fields)
159
         
166
         

Loading…
Cancel
Save