prieto 8 lat temu
rodzic
commit
e4214a1705

+ 4
- 0
lodel/leapi/datahandlers/base_classes.py Wyświetl plik

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

+ 11
- 4
plugins/webui/interface/controllers/admin.py Wyświetl plik

@@ -145,15 +145,22 @@ def admin_create(request):
145 145
             # both are hidden in the form, to identify the object here
146 146
              if in_put != 'classname' and in_value != '':
147 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 152
                     in_value.replace(" ","")
151 153
                     in_value=in_value.split(',')
154
+                    in_value=list(in_value)
155
+                    l=list()
152 156
                     for i in in_value:
153 157
                         l.append(int(i))
154
-                    in_value=list(l)
158
+                    in_value=l
159
+
155 160
                 fields[in_put[12:]] = in_value
156
-                
161
+                if in_value == '':
162
+                    fields[in_put[12:]] = None
163
+                    
157 164
         # Insertion in the database of the values corresponding to a new object
158 165
         new_uid = target_leo.insert(fields)
159 166
         

Loading…
Anuluj
Zapisz