Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove phantom empty plugins before adding a new plugin in a placehol…

…der.
  • Loading branch information...
commit 6518bd03ef7a6fcb20b6dc9fe2d7afd42fe33ff0 1 parent e052694
@mpaolini authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 cms/admin/pageadmin.py
View
7 cms/admin/pageadmin.py
@@ -1089,6 +1089,13 @@ def add_plugin(self, request):
# page add-plugin
if page:
language = request.POST['language'] or get_language_from_request(request)
+ # Remove empty plugins (created by adding it and then pressing
+ # cancel button in admin popup.
+ # It is needed to avoid enforcing limits with this pahantom
+ # plugins stealing free slots.
+ for pl in CMSPlugin.objects.filter(language=language, placeholder=placeholder):
+ if pl.get_plugin_instance()[0] is None:
+ pl.delete()
position = CMSPlugin.objects.filter(language=language, placeholder=placeholder).count()
limits = placeholder_utils.get_placeholder_conf("limits", placeholder.slot, page.get_template())
if limits:

0 comments on commit 6518bd0

Please sign in to comment.
Something went wrong with that request. Please try again.