Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'hotfix/2.1.1'

  • Loading branch information...
commit 6593d611c636ef96134cff8497eb6c3c97f06561 2 parents 6ec0673 + ae48a46
Jonas Obrist ojii authored
2  cms/__init__.py
... ... @@ -1,5 +1,5 @@
1 1 # -*- coding: utf-8 -*-
2   -VERSION = (2, 1, 0, 'final')
  2 +VERSION = (2, 1, 1, 'final')
3 3 if VERSION[-1] != "final": # pragma: no cover
4 4 __version__ = '.'.join(map(str, VERSION))
5 5 else: # pragma: no cover
2  cms/admin/pageadmin.py
@@ -1367,7 +1367,7 @@ def change_moderation(self, request, page_id):
1367 1367 return render_admin_menu_item(request, page)
1368 1368 raise Http404
1369 1369
1370   - def lookup_allowed(self, key):
  1370 + def lookup_allowed(self, key, *args, **kwargs):
1371 1371 if key == 'site__exact':
1372 1372 return True
1373 1373 return super(PageAdmin, self).lookup_allowed(key)
19 cms/forms/widgets.py
... ... @@ -1,15 +1,16 @@
1 1 # -*- coding: utf-8 -*-
2   -from django.utils.safestring import mark_safe
3   -from django.utils.encoding import force_unicode
4   -from django.contrib.sites.models import Site
5   -from django.conf import settings
6   -from django.utils.translation import ugettext as _
7   -from django.template.loader import render_to_string
8   -from django.forms.widgets import Select, MultiWidget, Widget
  2 +from cms.forms.utils import get_site_choices, get_page_choices
9 3 from cms.models import Page, PageUser, Placeholder
10 4 from cms.plugin_pool import plugin_pool
11   -from cms.forms.utils import get_site_choices, get_page_choices
12 5 from cms.utils import get_language_from_request
  6 +from django.conf import settings
  7 +from django.contrib.sites.models import Site
  8 +from django.forms.widgets import Select, MultiWidget, Widget
  9 +from django.template.context import RequestContext
  10 +from django.template.loader import render_to_string
  11 +from django.utils.encoding import force_unicode
  12 +from django.utils.safestring import mark_safe
  13 +from django.utils.translation import ugettext as _
13 14 from os.path import join
14 15 import copy
15 16
@@ -216,4 +217,4 @@ def render(self, name, value, attrs=None):
216 217 #return mark_safe(render_to_string(
217 218 # 'admin/cms/page/widgets/plugin_editor.html', context))
218 219 return mark_safe(render_to_string(
219   - 'admin/cms/page/widgets/placeholder_editor.html', context))
  220 + 'admin/cms/page/widgets/placeholder_editor.html', context, RequestContext(self.request)))
6 cms/media/cms/css/toolbar.css
@@ -764,7 +764,11 @@ a#closeBut:hover strong
764 764 background-position:-210px -188px;
765 765 }
766 766
767   -
  767 +#cms_toolbar_logoutform fieldset {
  768 + margin: 0;
  769 + padding: 0;
  770 + border: none;
  771 +}
768 772
769 773 /* button
770 774 ---------------------------------------------- */
3  cms/media/cms/js/change_list.js
@@ -92,7 +92,8 @@
92 92 tree.init($("div.tree"), options);
93 93 };
94 94
95   - $(document).ready(function() {
  95 + $(document).ready(function() {
  96 + patchCsrf($);
96 97 var selected_page = false;
97 98 var action = false;
98 99
1  cms/media/cms/js/plugin_editor.js
... ... @@ -1,6 +1,7 @@
1 1 (function($) {
2 2 $(document).ready(function() {
3 3 // Add Plugin Handler
  4 + patchCsrf(jQuery);
4 5 $('span.add-plugin').click(function(){
5 6 var select = $(this).parent().children("select[name=plugins]");
6 7 var pluginvalue = select.attr('value');
2  cms/media/cms/js/toolbar.js
@@ -11,6 +11,8 @@ function hide_iframe(){
11 11 }
12 12
13 13 jQuery(document).ready(function($) {
  14 +
  15 + patchCsrf(jQuery)
14 16
15 17 jQuery.fn.swapWith = function(to) {
16 18 return this.each(function() {
1  cms/templates/admin/cms/page/change_form.html
@@ -4,6 +4,7 @@
4 4
5 5 {% block extrahead %}
6 6 {{ block.super }}
  7 +{% include "cms/inc/csrf_js.html" %}
7 8 <script type="text/javascript" src="{% url admin:jsi18n %}"></script>
8 9
9 10 {% if not add %}
1  cms/templates/admin/cms/page/change_list.html
@@ -12,6 +12,7 @@
12 12
13 13 {% block coltype %}flex{% endblock %}
14 14 {% block extrahead %}
  15 +{% include "cms/inc/csrf_js.html" %}
15 16 <link rel="stylesheet" type="text/css" href="{{ CMS_MEDIA_URL }}css/pages.css"/>
16 17 <link rel="stylesheet" type="text/css" href="{{ CMS_MEDIA_URL }}jstree/tree_component.css" />
17 18 <link rel="stylesheet" type="text/css" href="{{ CMS_MEDIA_URL }}css/jquery.dialog.css" />
1  cms/templates/admin/cms/page/widgets/plugin_editor.html
@@ -18,6 +18,7 @@
18 18 {% endif %}
19 19 {% endif %}
20 20 </div>
  21 +{% include "cms/inc/csrf_js.html" %}
21 22 <script type="text/javascript">
22 23 jQuery(document).ready(function(){
23 24 var placeholder_element = jQuery('#placeholder-{{ placeholder.pk }}');
18 cms/templates/cms/inc/csrf_js.html
... ... @@ -0,0 +1,18 @@
  1 +<script type="text/javascript">
  2 +if ("{{ csrf_token }}" && !window.patchCsrf){
  3 + window.patchCsrf = function(jquery){
  4 + if (window.cmsCsrfPatched){
  5 + return;
  6 + }
  7 + jquery.ajaxSetup({
  8 + beforeSend: function(xhr, settings) {
  9 + if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
  10 + xhr.setRequestHeader("X-CSRFToken", "{{ csrf_token }}");
  11 + }
  12 + }
  13 + });
  14 + window.cmsCsrfPatched = true;
  15 + }
  16 +}
  17 +
  18 +</script>
1  cms/templates/cms/toolbar/toolbar.html
... ... @@ -1,4 +1,5 @@
1 1 {% load i18n adminmedia %}
  2 +{% include "cms/inc/csrf_js.html" %}
2 3 <script type="text/javascript" src="{% admin_media_prefix %}js/jquery.min.js"></script>
3 4 <script type="text/javascript">
4 5 //<![CDATA[
2  tests/buildout.cfg
@@ -25,7 +25,7 @@ scripts =
25 25
26 26 [django]
27 27 recipe = djangorecipe
28   -version = 1.2.4
  28 +version = 1.2.5
29 29 project = testapp
30 30 settings = settings
31 31 eggs = ${buildout:eggs}
3  tests/testapp/sampleapp/admin.py
... ... @@ -1,10 +1,11 @@
  1 +from cms.admin.placeholderadmin import PlaceholderAdmin
1 2 from django.contrib import admin
2 3 from testapp.sampleapp.models import Picture, Category
3 4
4 5 class PictureInline(admin.StackedInline):
5 6 model = Picture
6 7
7   -class CategoryAdmin(admin.ModelAdmin):
  8 +class CategoryAdmin(PlaceholderAdmin):
8 9 inlines = [PictureInline]
9 10
10 11 admin.site.register(Category, CategoryAdmin)

0 comments on commit 6593d61

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