Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a BootstrapRowPlugin fails because of incorrect empty_form value #390

Open
Xiphoseer opened this issue Oct 20, 2020 · 7 comments
Open
Labels

Comments

@Xiphoseer
Copy link

When trying to create Bootstrap 4 Row plugins, we ran into an issue where no settings were displayed in the creation form, but the creation failed with an error that told us to fix one of the settings.

After some investigation, I found that the num_columns field from the form was missing from the request and that there's a weird form_empty context value in templates/cascade/admin/change_form.html.

It turns out that for a form that doesn't use any django-entangled fields, this line in plugin_base.py sets that value but ignores any untangled_fields that may be present. Thus, no form fields appear in the admin view and consequently aren't included in the request to the server.

I would personally consider values like empty_form to be an anti-pattern, because they produce hard-to-debug cases like this one, but I appreciate that the intent is to inform the user that this form is intentionally blank if it were to work correctly.

@jrief
Copy link
Owner

jrief commented Oct 20, 2020

OK. I will have a look at it.

@Xiphoseer
Copy link
Author

Is there any update to this? I can try to create a PR, but I'm not sure I understand the details of django-entangled enough for that.

@svandeneertwegh
Copy link

Same problem here. Any updates?

@jrief jrief added the bug label Feb 24, 2021
@jrief
Copy link
Owner

jrief commented Feb 24, 2021

@Xiphoseer Just one additional question: Did you create your own plugin with its own form, or did you use the BootstrapRowPlugin as provided by djangocms-cascade?

@Xiphoseer
Copy link
Author

@Xiphoseer Just one additional question: Did you create your own plugin with its own form, or did you use the BootstrapRowPlugin as provided by djangocms-cascade?

We did create our own djangocms-cascade plugins (here) but none of them change, override or derive from BootstrapRowPlugin. So as far as I can tell, we used the BootstrapRowPlugin as provided.

I made sure to verify this behavior on a page without any of our custom plugins before filing this bug.

@jrief
Copy link
Owner

jrief commented Feb 24, 2021

But I absolutely agree, that I should not render an "Empty form message", if there are any untangled_fields in the form's Meta class. This should be fixed.

@jrief jrief closed this as completed in dddf1ed Feb 24, 2021
@jrief jrief reopened this Feb 24, 2021
@jrief
Copy link
Owner

jrief commented Feb 24, 2021

Could you please retry with the latest version from this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants