divio/django-cms — pull request #3194 by damianmoore (2014-05-24 11:02:51+00:00)
Title: Fix for re-ordering plugins when JS provides language as empty string

I was having a problem where I couldn't re-order plugins within a placeholder, similar to this issue: https://github.com/divio/django-cms/issues/3058

This caused an error to popup on move "order parameter did not have all plugins of the same level in it" and then the move plugin would be removed.

I found that the `move_plugin()` method of `admin/placeholderadmin.py` was not finding the other `plugins` correctly as it was searching for a language of '' (empty string) rather than the language that the plugins had ('en-gb'). This is because the JavaScript POST included a `plugin_language` of empty string.

As far as I can see, this JS variable comes from a GET parameter of the request so is not reliably there. Falling back to the language of the plugin seems a sensible fix to me.

Maybe there is some extra configuration would otherwise solve this, but I can't find it.