-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Sane add plugin #3516
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
Sane add plugin #3516
Conversation
@FinalAngel could you have a look at this, especially ojii@256b691? (note: I fixed the spaces/tabs in the next commit) |
@ojii looks sane coding wise, would also speed up loading time, are you sure that |
Yep |
Conflicts: cms/admin/placeholderadmin.py
Test on here will fail until django-cms/djangocms-text-ckeditor#179 and django-cms/djangocms-link#29 get merged... |
@yakky @mkoistinen looks like the failures are unrelated to code (within selenium failing to connect to the remote webdriver), any clue how to fix this? Just keep hitting "restart" until it works? |
All failures are related to custom user models. What happens locally when using it? |
The problem is |
@ojii can't we just switch to --xvfb? |
I cannot get the selenium tests to run locally
|
In other pull requests tests run fine by using the same travis configuration. |
Conflicts: cms/admin/placeholderadmin.py cms/plugin_base.py
Okay I give up. I'm happy to fix any issues with the code but simply give up getting this to work on travis. If anyone wants to take over this, that would be awesome. |
Conflicts: cms/tests/frontend.py cms/tests/plugins.py
closing in favor of #3804 |
Historically, when a user wanted to add a plugin to a placeholder, upon selecting the plugin, the CMS would create a plugin instance in the database, then show the user the add form. In various cases where the user would not complete the process, "ghost plugins" would be created. These have always been somewhere between a nuisance and an actual problem, sometimes going as far as crashing an site.
This pull request attempts to solve this by not creating a plugin until after the user hits save on the add form.
This changes the contract for
CMSPluginBase
subclasses and brings them more in line with it's parent,ModelAdmin
. Specificallyhas_add_permission
now needs to be properly implemented, instead of just usinghas_change_permission
,get_form
actually has to respect theobj
parameter (which can beNone
) andadd_view
will actually be called. Further, aadd_view_check_request
helper function was added toCMSPluginBase
which verifies aHttpRequest
toadd_view
has the required GET parameters. This may be used by subclasses wishing to modifyadd_view
.This pull request breaks at least djangocms-text-ckeditor and djangocms-link, both of which have pull requests to make them compatible (see django-cms/djangocms-text-ckeditor#179 and django-cms/djangocms-link#29).
This will break any plugin that assumes an object to be around in
get_form
oradd_view
either by assumingself.cms_plugin_instance
to be available or in the case ofget_form
that theobj
argument is notNone
.Todo