Updated slot add form
authorThierry Florac <thierry.florac@onf.fr>
Tue, 25 Sep 2018 12:50:40 +0200
changeset 193 304a0c77fcb9
parent 192 c201eaf392c2
child 194 08a86e82f541
Updated slot add form
src/pyams_portal/zmi/layout.py
--- a/src/pyams_portal/zmi/layout.py	Tue Sep 25 11:33:10 2018 +0200
+++ b/src/pyams_portal/zmi/layout.py	Tue Sep 25 12:50:40 2018 +0200
@@ -247,15 +247,16 @@
 
     def updateWidgets(self, prefix=None):
         super(PortalTemplateSlotAddForm, self).updateWidgets()
-        self.widgets['row_id'].value = self.request.params.get('{0}{1}row_id'.format(self.prefix, self.widgets.prefix))
-        if self.widgets['row_id'].value:
+        row_id = self.request.params.get('{0}{1}row_id'.format(self.prefix, self.widgets.prefix))
+        if row_id:
+            self.widgets['row_id'].value = str(int(row_id) + 1)
             self.widgets['row_id'].mode = HIDDEN_MODE
 
     def createAndAdd(self, data):
         data = data.get(self, data)
         config = IPortalTemplateConfiguration(self.context)
         row_id = data.get('row_id')
-        if row_id is not None:
+        if row_id:
             row_id = row_id - 1
         return config.add_slot(data.get('name'), row_id)