|
@@ -57,13 +57,15 @@ def admin_update(request):
|
57
|
57
|
dhl = target_leo.data_handler(in_put[12:])
|
58
|
58
|
# Here, in case of a Reference we transform the str
|
59
|
59
|
# given by the form in a iterable (a list)
|
60
|
|
- if dhl.is_reference() and in_value != '':
|
|
60
|
+ if dhl.is_reference() and in_value != '' and not dhl.is_singlereference():
|
61
|
61
|
in_value.replace(" ","")
|
62
|
62
|
in_value=in_value.split(',')
|
63
|
63
|
in_value=list(in_value)
|
64
|
|
- if in_value != '':
|
|
64
|
+ if in_value == '':
|
|
65
|
+ fields[in_put[12:]] = None
|
|
66
|
+ else:
|
65
|
67
|
fields[in_put[12:]] = in_value
|
66
|
|
-
|
|
68
|
+
|
67
|
69
|
# We retrieve the object to update
|
68
|
70
|
filter_q = '%s = %s' % (uid_field, uid)
|
69
|
71
|
obj = (target_leo.get((filter_q)))[0]
|
|
@@ -145,22 +147,15 @@ def admin_create(request):
|
145
|
147
|
# both are hidden in the form, to identify the object here
|
146
|
148
|
if in_put != 'classname' and in_value != '':
|
147
|
149
|
dhl = target_leo.data_handler(in_put[12:])
|
148
|
|
- if dhl.is_singlereference():
|
149
|
|
- in_value=int(in_value)
|
150
|
|
- elif dhl.is_reference() and in_value != '':
|
|
150
|
+ if dhl.is_reference() and in_value != '' and not dhl.is_singlereference():
|
151
|
151
|
logger.info(in_value)
|
152
|
152
|
in_value.replace(" ","")
|
153
|
153
|
in_value=in_value.split(',')
|
154
|
154
|
in_value=list(in_value)
|
155
|
|
- l=list()
|
156
|
|
- for i in in_value:
|
157
|
|
- l.append(int(i))
|
158
|
|
- in_value=l
|
159
|
|
-
|
160
|
155
|
fields[in_put[12:]] = in_value
|
161
|
156
|
if in_value == '':
|
162
|
|
- fields[in_put[12:]] = None
|
163
|
|
-
|
|
157
|
+ fields[in_put[12:]] = None
|
|
158
|
+
|
164
|
159
|
# Insertion in the database of the values corresponding to a new object
|
165
|
160
|
new_uid = target_leo.insert(fields)
|
166
|
161
|
|