Added base class for paragraphs add forms
authorThierry Florac <thierry.florac@onf.fr>
Tue, 12 Sep 2017 16:41:24 +0200
changeset 148 e4b89f5fb5ea
parent 147 298fd55f6554
child 149 128e447b6a7f
Added base class for paragraphs add forms
src/pyams_content/component/paragraph/zmi/__init__.py
--- a/src/pyams_content/component/paragraph/zmi/__init__.py	Tue Sep 12 16:40:44 2017 +0200
+++ b/src/pyams_content/component/paragraph/zmi/__init__.py	Tue Sep 12 16:41:24 2017 +0200
@@ -25,7 +25,7 @@
 from pyams_zmi.layer import IAdminLayer
 
 # import packages
-from pyams_form.form import AJAXEditForm
+from pyams_form.form import AJAXEditForm, AJAXAddForm
 from pyams_form.help import FormHelp
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.viewlet.menu import MenuItem
@@ -80,9 +80,17 @@
 
 
 #
-# Base paragraph add form
+# Base paragraph forms
 #
 
+class BaseParagraphAJAXAddForm(AJAXAddForm):
+    """Base paragraph AJAX add form"""
+
+    def get_ajax_output(self, changes):
+        return {'status': 'reload',
+                'location': '#paragraphs.html'}
+
+
 class BaseParagraphAJAXEditForm(AJAXEditForm):
     """Base paragraph AJAX edit form"""