Skip to content

Commit e835e90

Browse files
authored
Updated README.rst to show where to add actions (#14)
in your project. Noted Fabian's suggestion of using models.py and also suggested using the app's apps.py file.
1 parent cdd60de commit e835e90

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,32 @@ Upon submission of a valid form actions can be performed. A project can register
9898
... # This method is run upon successful submission of the form
9999

100100

101+
To add this action, this needs to be added to your project at startup. Fabian suggests putting these actions in your apps models.py file. Another options is your apps, apps.py file::
102+
103+
from django.apps import AppConfig
104+
105+
class MyAppConfig(AppConfig):
106+
default_auto_field = 'django.db.models.BigAutoField'
107+
name = 'myapp'
108+
label = 'myapp'
109+
verbose_name = _("My App")
110+
111+
def ready(self):
112+
super().ready()
113+
114+
from djangocms_form_builder import actions
115+
116+
@actions.register
117+
class MyAction(actions.FormAction):
118+
verbose_name = _("Everything included action")
119+
120+
def execute(self, form, request):
121+
... # This method is run upon successful submission of the form
122+
# Process form and request data, you can send an email to the person who filled the form
123+
# Or admins though that functionality is available from the default SendMailAction
124+
125+
126+
101127
Using (existing) Django forms with djangocms-form-builder
102128
=========================================================
103129

0 commit comments

Comments
 (0)