Permalink
Browse files

Merge branch 'develop' into fix_pagefield

  • Loading branch information...
2 parents aa99b53 + 8c4327f commit 87f04d23d880a31c6fabbbab28b87f7068194368 @digi604 committed Apr 6, 2013
Showing with 18,711 additions and 12,606 deletions.
  1. +3 −4 .travis.yml
  2. +3 −1 AUTHORS
  3. +5 −0 CHANGELOG.txt
  4. +6 −3 cms/admin/forms.py
  5. +208 −217 cms/admin/pageadmin.py
  6. +0 −18 cms/admin/permissionadmin.py
  7. +18 −25 cms/admin/placeholderadmin.py
  8. +1 −1 cms/cms_toolbar.py
  9. +8 −1 cms/exceptions.py
  10. +3 −4 cms/forms/utils.py
  11. BIN cms/locale/ar/LC_MESSAGES/django.mo
  12. +245 −252 cms/locale/ar/LC_MESSAGES/django.po
  13. BIN cms/locale/bg/LC_MESSAGES/django.mo
  14. +245 −252 cms/locale/bg/LC_MESSAGES/django.po
  15. BIN cms/locale/bn/LC_MESSAGES/django.mo
  16. +211 −249 cms/locale/bn/LC_MESSAGES/django.po
  17. BIN cms/locale/bn/LC_MESSAGES/djangojs.mo
  18. +8 −9 cms/locale/bn/LC_MESSAGES/djangojs.po
  19. BIN cms/locale/ca/LC_MESSAGES/django.mo
  20. +245 −252 cms/locale/ca/LC_MESSAGES/django.po
  21. BIN cms/locale/cs/LC_MESSAGES/django.mo
  22. +613 −577 cms/locale/cs/LC_MESSAGES/django.po
  23. BIN cms/locale/cy/LC_MESSAGES/django.mo
  24. +211 −249 cms/locale/cy/LC_MESSAGES/django.po
  25. BIN cms/locale/da/LC_MESSAGES/django.mo
  26. +245 −252 cms/locale/da/LC_MESSAGES/django.po
  27. BIN cms/locale/de/LC_MESSAGES/django.mo
  28. +286 −417 cms/locale/de/LC_MESSAGES/django.po
  29. BIN cms/locale/de/LC_MESSAGES/djangojs.mo
  30. +2 −1 cms/locale/de/LC_MESSAGES/djangojs.po
  31. BIN cms/locale/el/LC_MESSAGES/django.mo
  32. +222 −251 cms/locale/el/LC_MESSAGES/django.po
  33. BIN cms/locale/en/LC_MESSAGES/django.mo
  34. +219 −253 cms/locale/en/LC_MESSAGES/django.po
  35. BIN cms/locale/es/LC_MESSAGES/django.mo
  36. +245 −252 cms/locale/es/LC_MESSAGES/django.po
  37. BIN cms/locale/es_AR/LC_MESSAGES/django.mo
  38. +221 −251 cms/locale/es_AR/LC_MESSAGES/django.po
  39. BIN cms/locale/es_BO/LC_MESSAGES/django.mo
  40. +245 −252 cms/locale/es_BO/LC_MESSAGES/django.po
  41. BIN cms/locale/es_DO/LC_MESSAGES/django.mo
  42. +1,889 −0 cms/locale/es_DO/LC_MESSAGES/django.po
  43. BIN cms/locale/et/LC_MESSAGES/django.mo
  44. +228 −251 cms/locale/et/LC_MESSAGES/django.po
  45. BIN cms/locale/eu/LC_MESSAGES/django.mo
  46. +236 −252 cms/locale/eu/LC_MESSAGES/django.po
  47. BIN cms/locale/fa/LC_MESSAGES/django.mo
  48. +245 −252 cms/locale/fa/LC_MESSAGES/django.po
  49. BIN cms/locale/fi/LC_MESSAGES/django.mo
  50. +245 −252 cms/locale/fi/LC_MESSAGES/django.po
  51. BIN cms/locale/fr/LC_MESSAGES/django.mo
  52. +245 −252 cms/locale/fr/LC_MESSAGES/django.po
  53. BIN cms/locale/gu/LC_MESSAGES/django.mo
  54. +211 −249 cms/locale/gu/LC_MESSAGES/django.po
  55. BIN cms/locale/he/LC_MESSAGES/django.mo
  56. +213 −250 cms/locale/he/LC_MESSAGES/django.po
  57. BIN cms/locale/hi/LC_MESSAGES/django.mo
  58. +245 −252 cms/locale/hi/LC_MESSAGES/django.po
  59. BIN cms/locale/hr/LC_MESSAGES/django.mo
  60. +245 −252 cms/locale/hr/LC_MESSAGES/django.po
  61. BIN cms/locale/hu/LC_MESSAGES/django.mo
  62. +232 −252 cms/locale/hu/LC_MESSAGES/django.po
  63. BIN cms/locale/is/LC_MESSAGES/django.mo
  64. +1,923 −0 cms/locale/is/LC_MESSAGES/django.po
  65. BIN cms/locale/is/LC_MESSAGES/djangojs.mo
  66. +39 −0 cms/locale/is/LC_MESSAGES/djangojs.po
  67. BIN cms/locale/it/LC_MESSAGES/django.mo
  68. +245 −252 cms/locale/it/LC_MESSAGES/django.po
  69. BIN cms/locale/ja/LC_MESSAGES/django.mo
  70. +249 −300 cms/locale/ja/LC_MESSAGES/django.po
  71. BIN cms/locale/ka/LC_MESSAGES/django.mo
  72. +213 −250 cms/locale/ka/LC_MESSAGES/django.po
  73. BIN cms/locale/ka/LC_MESSAGES/djangojs.mo
  74. +39 −0 cms/locale/ka/LC_MESSAGES/djangojs.po
  75. BIN cms/locale/km/LC_MESSAGES/django.mo
  76. +239 −252 cms/locale/km/LC_MESSAGES/django.po
  77. BIN cms/locale/ku_IQ/LC_MESSAGES/django.mo
  78. +245 −252 cms/locale/ku_IQ/LC_MESSAGES/django.po
  79. BIN cms/locale/nb/LC_MESSAGES/django.mo
  80. +245 −252 cms/locale/nb/LC_MESSAGES/django.po
  81. BIN cms/locale/nl/LC_MESSAGES/django.mo
  82. +245 −252 cms/locale/nl/LC_MESSAGES/django.po
  83. BIN cms/locale/no/LC_MESSAGES/django.mo
  84. +1,945 −0 cms/locale/no/LC_MESSAGES/django.po
  85. BIN cms/locale/no/LC_MESSAGES/djangojs.mo
  86. +39 −0 cms/locale/no/LC_MESSAGES/djangojs.po
  87. BIN cms/locale/pl/LC_MESSAGES/django.mo
  88. +245 −252 cms/locale/pl/LC_MESSAGES/django.po
  89. BIN cms/locale/pt/LC_MESSAGES/django.mo
  90. +245 −252 cms/locale/pt/LC_MESSAGES/django.po
  91. BIN cms/locale/pt_BR/LC_MESSAGES/django.mo
  92. +245 −252 cms/locale/pt_BR/LC_MESSAGES/django.po
  93. BIN cms/locale/ro/LC_MESSAGES/django.mo
  94. +233 −255 cms/locale/ro/LC_MESSAGES/django.po
  95. BIN cms/locale/ru/LC_MESSAGES/django.mo
  96. +245 −252 cms/locale/ru/LC_MESSAGES/django.po
  97. BIN cms/locale/sk/LC_MESSAGES/django.mo
  98. +245 −252 cms/locale/sk/LC_MESSAGES/django.po
  99. BIN cms/locale/sl_SI/LC_MESSAGES/django.mo
  100. +245 −252 cms/locale/sl_SI/LC_MESSAGES/django.po
  101. BIN cms/locale/sr@latin/LC_MESSAGES/django.mo
  102. +245 −252 cms/locale/sr@latin/LC_MESSAGES/django.po
  103. BIN cms/locale/sv/LC_MESSAGES/django.mo
  104. +313 −440 cms/locale/sv/LC_MESSAGES/django.po
  105. BIN cms/locale/th_TH/LC_MESSAGES/django.mo
  106. +211 −249 cms/locale/th_TH/LC_MESSAGES/django.po
  107. BIN cms/locale/tr/LC_MESSAGES/django.mo
  108. +242 −252 cms/locale/tr/LC_MESSAGES/django.po
  109. BIN cms/locale/uk/LC_MESSAGES/django.mo
  110. +216 −250 cms/locale/uk/LC_MESSAGES/django.po
  111. BIN cms/locale/zh_CN/LC_MESSAGES/django.mo
  112. +245 −252 cms/locale/zh_CN/LC_MESSAGES/django.po
  113. BIN cms/locale/zh_TW/LC_MESSAGES/django.mo
  114. +245 −252 cms/locale/zh_TW/LC_MESSAGES/django.po
  115. +8 −6 cms/management/commands/subcommands/delete_orphaned_plugins.py
  116. +9 −3 cms/management/commands/subcommands/list.py
  117. +184 −0 cms/migrations/0039_auto__del_field_page_moderator_state.py
  118. +0 −5 cms/models/moderatormodels.py
  119. +72 −39 cms/models/pagemodel.py
  120. +4 −5 cms/models/pluginmodel.py
  121. +1 −1 cms/models/query.py
  122. +1 −1 cms/models/titlemodels.py
  123. +14 −3 cms/plugin_base.py
  124. +3 −3 cms/plugins/text/models.py
  125. +43 −4 cms/plugins/utils.py
  126. +1 −1 cms/signals.py
  127. +7 −21 cms/static/cms/css/pages.css
  128. +5 −1 cms/static/cms/js/change_form.js
  129. +4 −3 cms/static/cms/js/change_list.js
  130. +12 −7 cms/static/cms/js/plugin_editor.js
  131. +22 −7 cms/static/cms/js/plugins/cms.placeholders.js
  132. +22 −37 cms/templates/admin/cms/page/change_form.html
  133. +0 −9 cms/templates/admin/cms/page/change_list.html
  134. +1 −5 cms/templates/admin/cms/page/change_list_tree.html
  135. +1 −8 cms/templates/admin/cms/page/menu_item.html
  136. +1 −1 cms/templates/admin/cms/page/plugin_change_form.html
  137. +11 −2 cms/templatetags/cms_js_tags.py
  138. +30 −16 cms/templatetags/cms_tags.py
  139. +12 −9 cms/test_utils/cli.py
  140. +2 −1 cms/test_utils/project/sampleapp/templates/sampleapp/app.html
  141. +4 −3 cms/test_utils/project/sampleapp/templates/sampleapp/extra.html
  142. +1 −1 cms/test_utils/project/sampleapp/templates/sampleapp/home.html
  143. +1 −0 cms/test_utils/project/templates/alt_plugin_templates/show_placeholder/cms/plugins/text.html
  144. +1 −1 cms/test_utils/project/templates/placeholder_tests/base.html
  145. +17 −0 cms/test_utils/project/templates/placeholder_tests/base_sekizai.html
  146. +15 −0 cms/test_utils/project/templates/placeholder_tests/outside_base_sekizai.html
  147. +1 −1 cms/test_utils/project/templates/placeholder_tests/outside_nested.html
  148. +1 −0 cms/test_utils/project/templates/placeholder_tests/outside_nested_sekizai.html
  149. +14 −0 cms/test_utils/project/templates/placeholder_tests/outside_sekizai.html
  150. +1 −1 cms/test_utils/project/templates/placeholder_tests/test_one.html
  151. +16 −0 cms/test_utils/project/templates/placeholder_tests/test_one_sekizai.html
  152. +17 −0 cms/test_utils/project/templates/placeholder_tests/test_three_sekizai.html
  153. +34 −0 cms/test_utils/testcases.py
  154. +67 −71 cms/tests/admin.py
  155. +54 −19 cms/tests/check.py
  156. +167 −3 cms/tests/i18n.py
  157. +1 −1 cms/tests/management.py
  158. +114 −9 cms/tests/multilingual.py
  159. +94 −2 cms/tests/page.py
  160. +5 −2 cms/tests/permmod.py
  161. +66 −2 cms/tests/placeholder.py
  162. +30 −3 cms/tests/plugins.py
  163. +71 −26 cms/tests/reversion_tests.py
  164. +0 −3 cms/tests/staticfiles.py
  165. +54 −23 cms/tests/templatetags.py
  166. +1 −1 cms/tests/toolbar.py
  167. +4 −5 cms/tests/views.py
  168. +3 −8 cms/utils/__init__.py
  169. +2 −3 cms/utils/admin.py
  170. +23 −1 cms/utils/check.py
  171. +15 −1 cms/utils/conf.py
  172. +5 −1 cms/utils/helpers.py
  173. +31 −3 cms/utils/i18n.py
  174. +1 −1 cms/utils/moderator.py
  175. +3 −8 cms/utils/page_resolver.py
  176. +5 −2 cms/utils/plugins.py
  177. +0 −47 cms/utils/timezone.py
  178. +20 −0 compilemessages.py
  179. +7 −0 docs/advanced/i18n.rst
  180. +7 −0 docs/advanced/templatetags.rst
  181. +13 −0 docs/extending_cms/api_references.rst
  182. +31 −4 docs/extending_cms/custom_plugins.rst
  183. +81 −0 docs/getting_started/configuration.rst
  184. +13 −3 docs/getting_started/installation.rst
  185. +78 −48 docs/upgrade/2.4.rst
  186. +1 −6 makemessages.py
  187. +1 −1 menus/templates/menu/language_chooser.html
  188. +1 −0 runtests.py
  189. +1 −2 runtestserver.py
  190. +3 −3 setup.py
  191. +0 −5 test_requirements/django-1.3.txt
  192. +2 −2 test_requirements/django-1.4.txt
  193. +4 −0 test_requirements/django-1.5.txt
  194. +1 −1 test_requirements/requirements_base.txt
View
@@ -1,15 +1,14 @@
language: python
python:
- - "2.5"
- "2.6"
- "2.7"
env:
- - DJANGO=test_requirements/django-1.3.txt DB='sqlite://localhost/:memory:'
- - DJANGO=test_requirements/django-1.3.txt DB='mysql://root@127.0.0.1/djangocms_test'
- - DJANGO=test_requirements/django-1.3.txt DB='postgres://postgres@127.0.0.1/djangocms_test'
- DJANGO=test_requirements/django-1.4.txt DB='sqlite://localhost/:memory:'
- DJANGO=test_requirements/django-1.4.txt DB='mysql://root@127.0.0.1/djangocms_test'
- DJANGO=test_requirements/django-1.4.txt DB='postgres://postgres@127.0.0.1/djangocms_test'
+ - DJANGO=test_requirements/django-1.5.txt DB='sqlite://localhost/:memory:'
+ - DJANGO=test_requirements/django-1.5.txt DB='mysql://root@127.0.0.1/djangocms_test'
+ - DJANGO=test_requirements/django-1.5.txt DB='postgres://postgres@127.0.0.1/djangocms_test'
before_script:
- sh -c "if [ '$DB' = 'postgres://postgres@127.0.0.1/djangocms_test' ]; then psql -c 'DROP DATABASE IF EXISTS djangocms_test;' -U postgres; fi"
View
@@ -150,9 +150,10 @@ Contributors (in alphabetical order):
* Mel Collins
* meers
* MerLex
-* Mokys
+* Michael P. Jung
* Mike Johnson
* Mitar
+* Mokys
* mrlundis
* MW
* neoprolog
@@ -163,6 +164,7 @@ Contributors (in alphabetical order):
* Pascal Mouret
* Patrick Toal
* Paul van der Linden
+* Paulo Alvarado
* Pavel Puchkin
* pbgc
* Pedro Gracia
View
@@ -122,6 +122,10 @@
Please see Install/2.4 release notes *before* attempting to upgrade to version 2.4.
+- Compatibility with Django 1.4 and 1.5 (1.3 support dropped)
+- Support for Python 2.5 dropped
+- CMS_MAX_PAGE_PUBLISH_REVERSIONS has been added
+- Reversion integration has changed to limit DB size
- CMS_LANGUAGE setting has changed
- CMS_HIDE_UNTRANSLATED setting removed
- CMS_LANGUAGE_FALLBACK setting removed
@@ -131,5 +135,6 @@ Please see Install/2.4 release notes *before* attempting to upgrade to version 2
- MultilingualMiddleware has been removed
- CMS_FLAT_URLS has been removed
+
==== NEXT ====
- Fixed #1543: Nasty empty line in cms/plugins/link.html
View
@@ -3,7 +3,7 @@
from cms.apphook_pool import apphook_pool
from cms.forms.widgets import UserSelectAdminWidget
from cms.models import (Page, PagePermission, PageUser, ACCESS_PAGE,
- PageUserGroup)
+ PageUserGroup, titlemodels)
from cms.utils.conf import get_cms_setting
from cms.utils.i18n import get_language_tuple, get_language_list
from cms.utils.mail import mail_page_user_change
@@ -116,8 +116,11 @@ def clean(self):
#Check for titles attached to the page makes sense only because
#AdminFormsTests.test_clean_overwrite_url validates the form with when no page instance available
#Looks like just a theoretical corner case
- title = page.get_title_obj(lang)
- if title and slug:
+ try:
+ title = page.get_title_obj(lang, fallback=False)
+ except titlemodels.Title.DoesNotExist:
+ title = None
+ if title and not isinstance(title, titlemodels.EmptyTitle) and slug:
oldslug = title.slug
title.slug = slug
title.save()
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -6,36 +6,18 @@
from cms.utils.conf import get_cms_setting
from cms.utils.permissions import get_user_permission_level
from copy import deepcopy
-from distutils.version import LooseVersion
from django.conf import settings
from django.contrib import admin
from django.template.defaultfilters import title
from django.utils.translation import ugettext as _
-import django
-
-DJANGO_1_3 = LooseVersion(django.get_version()) < LooseVersion('1.4')
PAGE_ADMIN_INLINES = []
class TabularInline(admin.TabularInline):
pass
-if DJANGO_1_3 and 'reversion' in settings.INSTALLED_APPS:
- """
- Backwards compatibility for Django < 1.4 and django-reversion 1.6
- """
- class TabularInline(TabularInline):
- def get_prepopulated_fields(self, request, obj=None):
- return self.prepopulated_fields
- from reversion.admin import helpers
- class CompatInlineAdminFormSet(helpers.InlineAdminFormSet):
- def __init__(self, inline, formset, fieldsets, prepopulated_fields=None,
- readonly_fields=None, model_admin=None):
- super(CompatInlineAdminFormSet, self).__init__(inline, formset, fieldsets, readonly_fields, model_admin)
- helpers.InlineAdminFormSet = CompatInlineAdminFormSet
-
class PagePermissionInlineAdmin(TabularInline):
model = PagePermission
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
+from cms.exceptions import PluginLimitReached
from cms.forms.fields import PlaceholderFormField
from cms.models.fields import PlaceholderField
from cms.models.placeholdermodel import Placeholder
from cms.models.pluginmodel import CMSPlugin
from cms.plugin_pool import plugin_pool
from cms.utils import get_language_from_request, cms_static_url, get_cms_setting
from cms.utils.permissions import has_plugin_permission
+from cms.plugins.utils import has_reached_plugin_limit
from copy import deepcopy
from django.conf import settings
from django.contrib.admin import ModelAdmin
@@ -30,7 +32,7 @@ class Media:
'css/plugin_editor.css',
)]
}
- js = ['%sjs/jquery.min.js' % admin_static_url()] + [cms_static_url(path) for path in [
+ js = [cms_static_url(path) for path in [
'js/plugins/admincompat.js',
'js/csrf.js',
'js/libs/jquery.query.js',
@@ -149,27 +151,11 @@ def add_plugin(self, request):
# check add permissions on placeholder
if not placeholder.has_add_permission(request):
return HttpResponseForbidden(_("You don't have permission to add content here."))
-
- # check the limits defined in CMS_PLACEHOLDER_CONF for this placeholder
- limits = get_cms_setting('PLACEHOLDER_CONF').get(placeholder.slot, {}).get('limits', None)
- if limits:
- count = placeholder.cmsplugin_set.count()
- global_limit = limits.get("global", None)
- type_limit = limits.get(plugin_type, None)
- # check the global limit first
- if global_limit and count >= global_limit:
- return HttpResponseBadRequest(
- "This placeholder already has the maximum number of plugins."
- )
- elif type_limit: # then check the type specific limit
- type_count = CMSPlugin.objects.filter(
- language=language, placeholder=placeholder, plugin_type=plugin_type
- ).count()
- if type_count >= type_limit:
- return HttpResponseBadRequest(
- "This placeholder already has the maximum number (%s) "
- "of %s plugins." % (type_limit, plugin_type)
- )
+
+ try:
+ has_reached_plugin_limit(placeholder, plugin_type, language)
+ except PluginLimitReached, e:
+ return HttpResponseBadRequest(str(e))
# actually add the plugin
plugin = CMSPlugin(language=language, plugin_type=plugin_type,
@@ -209,19 +195,21 @@ def edit_plugin(self, request, plugin_id):
'CMS_MEDIA_URL': get_cms_setting('MEDIA_URL'),
'plugin': cms_plugin,
'is_popup': True,
- 'name': unicode(cms_plugin),
"type": cms_plugin.get_plugin_name(),
'plugin_id': plugin_id,
'icon': force_escape(escapejs(cms_plugin.get_instance_icon_src())),
'alt': force_escape(escapejs(cms_plugin.get_instance_icon_alt())),
'cancel': True,
}
instance = cms_plugin.get_plugin_instance()[0]
- if not instance:
+ if instance:
+ context['name'] = unicode(instance)
+ else:
# cancelled before any content was added to plugin
cms_plugin.delete()
context.update({
- "deleted":True,
+ "deleted": True,
+ 'name': unicode(cms_plugin),
})
return render_to_response('admin/cms/page/plugin_forms_ok.html', context, RequestContext(request))
@@ -271,6 +259,11 @@ def move_plugin(self, request):
if not placeholder.has_change_permission(request):
raise Http404
+ try:
+ has_reached_plugin_limit(placeholder, plugin.plugin_type, plugin.language)
+ except PluginLimitReached, e:
+ return HttpResponseBadRequest(str(e))
+
# plugin positions are 0 based, so just using count here should give us 'last_position + 1'
position = CMSPlugin.objects.filter(placeholder=placeholder).count()
plugin.placeholder = placeholder
View
@@ -91,7 +91,7 @@ def can_change(self):
@property
def edit_mode(self):
- return self.is_staff and self.edit_mode_switcher.get_state(self.request)
+ return self.is_staff and self.edit_mode_switcher.get_state(self.request) and self.can_change
@property
def show_toolbar(self):
View
@@ -7,6 +7,13 @@ class PluginNotRegistered(Exception):
pass
+class PluginLimitReached(Exception):
+ """
+ Gets triggered when a placeholder has reached it's plugin limit.
+ """
+ pass
+
+
class AppAlreadyRegistered(Exception):
pass
@@ -54,4 +61,4 @@ class DontUsePageAttributeWarning(Warning): pass
class CMSDeprecationWarning(Warning): pass
-class LanguageError(Exception): pass
+class LanguageError(Exception): pass
View
@@ -8,13 +8,12 @@
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.db.models.signals import post_save, post_delete
-from django.utils import translation
from django.utils.datastructures import SortedDict
from django.utils.safestring import mark_safe
def update_site_and_page_choices(lang=None):
- lang = lang or translation.get_language()
+ lang = lang or i18n.get_current_language()
SITE_CHOICES_KEY = get_site_cache_key(lang)
PAGE_CHOICES_KEY = get_page_cache_key(lang)
title_queryset = (Title.objects.drafts()
@@ -58,14 +57,14 @@ def update_site_and_page_choices(lang=None):
return site_choices, page_choices
def get_site_choices(lang=None):
- lang = lang or translation.get_language()
+ lang = lang or i18n.get_current_language()
site_choices = cache.get(get_site_cache_key(lang))
if site_choices is None:
site_choices, page_choices = update_site_and_page_choices(lang)
return site_choices
def get_page_choices(lang=None):
- lang = lang or translation.get_language()
+ lang = lang or i18n.get_current_language()
page_choices = cache.get(get_page_cache_key(lang))
if page_choices is None:
site_choices, page_choices = update_site_and_page_choices(lang)
Binary file not shown.
Oops, something went wrong.

0 comments on commit 87f04d2

Please sign in to comment.