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

Can't copy/move plugins when CMS_TOOLBAR_HIDE = True #6616

bhrutledge opened this Issue Feb 19, 2019 · 1 comment


None yet
1 participant
Copy link

bhrutledge commented Feb 19, 2019


I have CMS_TOOLBAR_HIDE = True as part of a workaround for #6608. However, now I'm getting an error modal when attempt to copy or move plugins. I've shared an example video on Dropbox.

I would like to write a failing test for this, but I'm not yet familiar enough with the code to know where to start.

Expected behaviour

With CMS_TOOLBAR_HIDE = True, I should be able to use Structure mode to copy and move plugins in and between placeholders.

Actual behaviour

With CMS_TOOLBAR_HIDE = True, when I attempt to copy or move a plugin in Structure mode, I get an error modal with following:

AttributeError at /en/admin/cms/page/copy-plugins/
Exception Value: 'WSGIRequest' object has no attribute 'toolbar'

I've reproduced this in a demo site, initially using 3.4.5 (as I'm currently using in the project where I discovered this), then upgraded to 3.6.0, using the Django CMS Installer.

$ djangocms --django-version 1.11 --cms-version 3.4 -p . -s mysite
$ pip install -U django-cms djangocms-admin-style


  • Python version: 2.7.15
  • Django version: 1.11.20
  • django CMS version: 3.4.5, 3.6.0



Request Method: POST
Request URL: http://localhost:8000/en/admin/cms/page/copy-plugins/?cms_path=%2Fen%2F

Django Version: 1.11.20
Python Version: 2.7.15
Installed Applications:
Installed Middleware:


File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/core/handlers/" in inner
  41.             response = get_response(request)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/core/handlers/" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/core/handlers/" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/utils/" in _wrapped_view
  149.                     response = view_func(request, *args, **kwargs)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/views/decorators/" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/contrib/admin/" in inner
  224.             return view(request, *args, **kwargs)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/utils/" in _wrapper
  67.             return bound_func(*args, **kwargs)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/views/decorators/" in inner
  40.             return func(request, *args, **kwargs)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/utils/" in bound_func
  63.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/views/decorators/" in wrapped_view
  39.         resp = view_func(*args, **kwargs)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/django/utils/" in inner
  185.                     return func(*args, **kwargs)

File "/Users/brian/Code/django-cms-test/venv/lib/python2.7/site-packages/cms/admin/" in copy_plugins
  385.         copy_to_clipboard = ==

Exception Type: AttributeError at /en/admin/cms/page/copy-plugins/
Exception Value: 'WSGIRequest' object has no attribute 'toolbar'

This comment has been minimized.

Copy link

bhrutledge commented Feb 19, 2019

My workaround, similar to #6608, is to subclass ToolbarMiddleware and ensure that is_cms_request returns True for copy/move requests.

At the moment, that means augmenting this:

return match.url_name in ('pages-root', 'pages-details-by-slug')


or match.func.__module__ == 'cms.admin.placeholderadmin'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.