Skip to content

Commit 09073bf

Browse files
committed
Fix: key error bug if submitting form with invalid slug as name
1 parent 8709ce9 commit 09073bf

File tree

3 files changed

+22
-38
lines changed

3 files changed

+22
-38
lines changed

README.rst

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,17 @@
44

55
|pypi| |coverage| |python| |django| |djangocms| |djangocms4|
66

7-
**djangocms-form-builder** supports rendering of styled forms. The objective is
8-
to tightly integrate forms in the website design. **djangocms-form-builder**
9-
allows as many forms as you wish on one page. All forms are **ajax/xhr-based**.
10-
To this end, **djangocms-form-builder** extends the django CMS plugin model
11-
allowing a form plugin to receive ajax post requests.
7+
**djangocms-form-builder** supports rendering of styled forms. The objective is to tightly integrate forms in the website design. **djangocms-form-builder** allows as many forms as you wish on one page. All forms are **xhr-based**. To this end, **djangocms-form-builder** extends the django CMS plugin model allowing a form plugin to receive xhr post requests.
128

139
There are two different ways to manage forms with **djangocms-form-builder**:
1410

15-
1. **Building a form with django CMS' powerful structure board.** This is
16-
fast an easy. It integrates smoothly with other design elements, especially
17-
the grid elements allowing to design simple responsive forms.
11+
1. **Building a form with django CMS' powerful structure board.** This is fast an easy. It integrates smoothly with other design elements, especially the grid elements allowing to design simple responsive forms.
1812

19-
Form actions can be configured by form. Built in actions include saving the
20-
results in the database for later evaluation and mailing submitted forms to
21-
the site admins. Other form actions can be registered.
13+
Form actions can be configured by form. Built in actions include saving the results in the database for later evaluation and mailing submitted forms to the site admins. Other form actions can be registered.
2214

23-
2. Works with **django CMS v4** and **djangocms-alias** to manage your forms centrally.
24-
Djangocms-alias becomes your form editor and forms can be placed on pages by
25-
refering to them with their alias.
15+
2. Works with **django CMS v4** and **djangocms-alias** to manage your forms centrally. Djangocms-alias becomes your form editor and forms can be placed on pages by referring to them with their alias.
2616

27-
3. **Registering an application-specific form with djangocms-form-builder.** If you
28-
already have forms you may register them with djangocms-form-builder and allow
29-
editors to use them in the form plugin. If you only have simpler design
30-
requirements, **djangocms-form-builder** allows you to use fieldsets as with
31-
admin forms.
17+
3. **Registering an application-specific form with djangocms-form-builder.** If you already have forms you may register them with djangocms-form-builder and allow editors to use them in the form plugin. If you only have simpler design requirements, **djangocms-form-builder** allows you to use fieldsets as with admin forms.
3218

3319
**************
3420
Key features
@@ -40,44 +26,43 @@ There are two different ways to manage forms with **djangocms-form-builder**:
4026

4127
- Integrates with `django-crispy-forms <https://github.com/django-crispy-forms/django-crispy-forms>`_
4228

29+
- Integrates with `djangocms-frontend <https://github.com/django-cms/djangocms-frontend>`_
30+
4331

4432
Feedback
4533
========
4634

47-
This project is in a early stage. All feedback is welcome! Please
48-
mail me at fsbraun(at)gmx.de
35+
This project is in a early stage. All feedback is welcome! Please mail me at fsbraun(at)gmx.de
4936

5037
Also, all contributions are welcome.
5138

5239
Contributing
5340
============
5441

55-
This is a an open-source project. We'll be delighted to receive your
56-
feedback in the form of issues and pull requests. Before submitting your
57-
pull request, please review our `contribution guidelines
58-
<http://docs.django-cms.org/en/latest/contributing/index.html>`_.
59-
60-
We're grateful to all contributors who have helped create and maintain
61-
this package. Contributors are listed at the `contributors
62-
<https://github.com/fsbraun/djangocms-form-builder/graphs/contributors>`_
63-
section.
42+
This is a an open-source project. We'll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our `contribution guidelines <http://docs.django-cms.org/en/latest/contributing/index.html>`_.
6443

44+
We're grateful to all contributors who have helped create and maintain this package. Contributors are listed at the `contributors <https://github.com/fsbraun/djangocms-form-builder/graphs/contributors>`_ section.
6545

6646

47+
************
6748
Installation
68-
============
49+
************
6950

7051
For a manual install:
7152

53+
- run ``pip install djangocms-form-builder``, **or**
54+
7255
- run ``pip install git+https://github.com/fsbraun/djangocms-form-builder@master#egg=djangocms-form-builder``
7356

74-
- add ``djangocms_form_builder`` to your ``INSTALLED_APPS``:
57+
- add ``djangocms_form_builder`` to your ``INSTALLED_APPS``. (If you are using both djangocms-frontend and djangocms-form-builder, add it **after** djangocms-frontend
7558

7659
- run ``python manage.py migrate``
7760

78-
To use the **djangocms-form-builder** you will have to have
79-
jQuery installed in your project. ``djangocms-form-builder`` does not include
80-
jQuery.
61+
*****
62+
Usage
63+
*****
64+
65+
8166

8267

8368
.. |pypi| image:: https://badge.fury.io/py/djangocms-form-builder.svg

djangocms_form_builder/cms_plugins/ajax_plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def get_parent_classes(cls, slot, page, instance=None):
283283
"""Only valid if not inside form"""
284284
parent = instance
285285
while parent is not None:
286-
if parent.plugin_type == FormPlugin.__name__:
286+
if parent.plugin_type == cls.__name__:
287287
return [""]
288288
parent = parent.parent
289289
return super().get_parent_classes(slot, page, instance)

djangocms_form_builder/forms.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,8 @@ def __init__(self, *args, **kwargs):
183183
self.fields["form_actions"].choices = available_form_actions
184184

185185
def clean(self):
186-
print(f"{self.data=}")
187186
if self.cleaned_data.get("form_selection", "") == "":
188-
if not self.cleaned_data["form_name"]:
187+
if not self.cleaned_data.get("form_name", "-"):
189188
raise ValidationError(
190189
{
191190
"form_name": _(

0 commit comments

Comments
 (0)