Permalink
Browse files

Merge branch 'develop' into fix-mptt-command

Conflicts:
	docs/upgrade/2.4.rst
  • Loading branch information...
2 parents f83a2d5 + a75fde9 commit 2d186007499f98ddbcbf05f1aaead906fed5744f @digi604 committed Nov 27, 2012
View
@@ -118,7 +118,9 @@
- Fixed page change form (jQuery and permissions)
- Fixed placeholder field permission checks
-==== 2.4.0 ===-
+==== 2.4.0 ===
+
+Please see Install/2.4 release notes *before* attempting to upgrade to version 2.4.
- CMS_LANGUAGE setting has changed
- CMS_HIDE_UNTRANSLATED setting removed
@@ -299,8 +299,6 @@ def copy_page(self, target, site, position='first-child',
# copy titles of this page
for title in titles:
title.pk = None # setting pk = None creates a new instance
- title.publisher_public_id = None
- title.published = False
title.page = page
# create slug-copy for standard copy
@@ -463,6 +461,8 @@ def publish(self):
# finally delete the old public page
old_public.delete()
+ for title in new_public.title_set.all():
+ title.save()
# Check if there are some children which are waiting for parents to
# become published.
publish_set = self.get_descendants().filter(published=True)
@@ -331,6 +331,10 @@ def get_position_in_placeholder(self):
"""
return self.position + 1
+ def num_children(self):
+ if self.child_plugin_instances:
+ return len(self.child_plugin_instances)
+
reversion_register(CMSPlugin)
@@ -68,7 +68,18 @@ def render(self, name, value, attrs=None):
mce_config['plugins'] = plugins
if mce_config['theme'] == "simple":
mce_config['theme'] = "advanced"
- mce_config['theme_advanced_buttons1_add_before'] = "cmsplugins,cmspluginsedit"
+ # Add cmsplugin to first toolbar, if not already present
+ all_tools = []
+ idx = 0
+ while True:
+ idx += 1
+ buttons = mce_config.get('theme_advanced_buttons%d' % (idx,), None)
+ if buttons is None:
+ break
+ all_tools.extend(buttons.split(','))
+ if 'cmsplugins' not in all_tools and 'cmspluginsedit' not in all_tools:
+ mce_config['theme_advanced_buttons1_add_before'] = "cmsplugins,cmspluginsedit"
+
json = simplejson.dumps(mce_config)
html = [u'<textarea%s>%s</textarea>' % (flatatt(final_attrs), escape(value))]
if tinymce.settings.USE_COMPRESSOR:
View
@@ -67,7 +67,7 @@ def pre_save_title(instance, raw, **kwargs):
instance.tmp_path = None
instance.tmp_application_urls = None
- if instance.id:
+ if instance.id and not hasattr(instance, "tmp_path"):
try:
tmp_title = Title.objects.get(pk=instance.id)
instance.tmp_path = tmp_title.path
@@ -5,6 +5,7 @@
{% block content %}
<h2>Sample application home page - on page {% page_attribute page_title %}</h2>
<h3>{{ message }}</h3>
+ {% if my_params %}<p>my_params: {{ my_params }}</p>{% endif %}
{{ block.super }}
<ul>
<li>
@@ -8,9 +8,10 @@
urlpatterns = patterns('cms.test_utils.project.sampleapp.views',
url(r'^$', 'sample_view', {'message': 'sample root page',}, name='sample-root'),
url(r'^settings/$', 'sample_view', kwargs={'message': 'sample settings page'}, name='sample-settings'),
+ url(r'^myparams/(?P<my_params>[\w_-]+)/$', 'sample_view', name='sample-params'),
url(_(r'^account/$'), 'sample_view', {'message': 'sample account page'}, name='sample-account'),
url(r'^account/my_profile/$', 'sample_view', {'message': 'sample my profile page'}, name='sample-profile'),
- url(r'^(?P<id>[0-9]+)/$', 'category_view', name='category_view'),
+ url(r'^category/(?P<id>[0-9]+)/$', 'category_view', name='category_view'),
url(r'^notfound/$', 'notfound', name='notfound'),
url(r'^extra_1/$', 'extra_view', {'message': 'test urlconf'}, name='extra_first'),
url(r'^', include('cms.test_utils.project.sampleapp.urls_extra')),
View
@@ -304,6 +304,28 @@ def test_apphook_breaking_under_home_with_new_path_caching(self):
url = resolver.reverse('sample-root')
self.assertEqual(url, 'child/not-home/subchild/')
+ def test_apphook_urlpattern_order(self):
+ # this one includes the actual cms.urls, so it can be tested if
+ # they are loaded in the correct order (the cms page pattern must be last)
+ # (the other testcases replicate the inclusion code and thus don't test this)
+ with SettingsOverride(ROOT_URLCONF='cms.test_utils.project.urls'):
+ self.create_base_structure(APP_NAME, 'en')
+ path = reverse('extra_second')
+ response = self.client.get(path)
+ self.assertEquals(response.status_code, 200)
+ self.assertTemplateUsed(response, 'sampleapp/extra.html')
+ self.assertContains(response, "test included urlconf")
+
+ def test_apphooks_receive_url_params(self):
+ # make sure that urlparams actually reach the apphook views
+ with SettingsOverride(ROOT_URLCONF='cms.test_utils.project.urls'):
+ self.create_base_structure(APP_NAME, 'en')
+ path = reverse('sample-params', kwargs=dict(my_params='is-my-param-really-in-the-context-QUESTIONMARK'))
+ response = self.client.get(path)
+ self.assertEquals(response.status_code, 200)
+ self.assertTemplateUsed(response, 'sampleapp/home.html')
+ self.assertContains(response, 'my_params: is-my-param-really-in-the-context-QUESTIONMARK')
+
class ApphooksPageLanguageUrlTestCase(SettingsOverrideTestCase):
View
@@ -803,3 +803,40 @@ def test_multisite(self):
self.assertEqual(other.get_previous_filtered_sibling(), None)
self.assertEqual(home.get_previous_filtered_sibling(), None)
+
+class PageTreeTests(CMSTestCase):
+
+ def test_rename_node(self):
+ home = create_page('grandpa', 'nav_playground.html', 'en', slug='home', published=True)
+ home.publish()
+ parent = create_page('parent', 'nav_playground.html', 'en', slug='parent', published=True)
+ parent.publish()
+ child = create_page('child', 'nav_playground.html', 'en', slug='child', published=True, parent=parent)
+ child.publish()
+
+ page_title = Title.objects.get(page=parent)
+ page_title.slug = "father"
+ page_title.save()
+
+ parent = Page.objects.get(pk=parent.pk)
+ parent.publish()
+ child = Page.objects.get(pk=child.pk)
+
+ self.assertEqual(child.get_absolute_url(language='en'), '/en/father/child/')
+ self.assertEqual(child.publisher_public.get_absolute_url(language='en'), '/en/father/child/')
+
+
+ def test_move_node(self):
+ home = create_page('grandpa', 'nav_playground.html', 'en', slug='home', published=True)
+ home.publish()
+ parent = create_page('parent', 'nav_playground.html', 'en', slug='parent', published=True)
+ parent.publish()
+ child = create_page('child', 'nav_playground.html', 'en', slug='child', published=True, parent=home)
+ child.publish()
+
+ child.move_page(parent)
+ child.publish()
+ child.reload()
+
+ self.assertEqual(child.get_absolute_url(language='en'), '/en/parent/child/')
+ self.assertEqual(child.publisher_public.get_absolute_url(language='en'), '/en/parent/child/')
View
@@ -20,6 +20,6 @@
have standard reverse support.
"""
from cms.appresolver import get_app_patterns
- urlpatterns += get_app_patterns()
+ urlpatterns = get_app_patterns() + urlpatterns
urlpatterns = patterns('', *urlpatterns)
View
@@ -14,10 +14,9 @@ Install
*******
.. warning::
- In version 2.4 migrations have been completely rewritten to fix issues
- with newer south releases.
- If upgrading from prior 2.3.2 releases, please refer to
- :ref:`migrations-upgrade`
+ Version 2.4 introduces some significant changes that **require** action if
+ you are upgrading from a previous version. Please refer to
+ :ref:`Upgrading from previous versions <upgrade-to-2.4>`
.. toctree::
View
@@ -7,6 +7,73 @@ What's new in 2.4
*****************
+.. _upgrade-to-2.4:
+
+.. warning:: Upgrading from previous versions
+
+ 2.4 introduces some changes that **require** action if you are upgrading
+ from a previous version.
+
+ You will need to read the sections :ref:`migrations-upgrade` and
+ :ref:`cms-moderator-upgrade` below.
+
+
+.. _migrations-upgrade:
+
+Migrations overhaul
+===================
+In version 2.4 migrations have been completely rewritten to address issues with
+newer South releases.
+
+To ease the upgrading process, all the migrations for the `cms` application have
+been consolidated into a single migration file, `0001_initial.py`.
+
+* the migrations 0002 to 0036 inclusive still exist, but are now all *dummy*
+ migrations
+
+* migrations 0037 and later are *new* migrations
+
+How this affects you
+--------------------
+
+If you're starting with *a new installation*, you don't need to worry about
+this. Don't even bother reading this section; it's for upgraders.
+
+If you're using version *2.3.2 or newer*, you don't need to worry about this
+either.
+
+If you're using version *2.3.1 or older*, you will need to run a two-step
+process.
+
+First, you'll need to upgrade to 2.3.3, to bring your migration history
+up-to-date with the new scheme. Then you'll need to perform the migrations for
+2.4.
+
+For the two-step upgrade process do the following in your project main directory
+::
+
+ pip install django-cms==2.3.3
+ python manage.py syncdb
+ python manage.py migrate
+ pip install django-cms==2.4
+ python manage.py migrate
+
+
+.. _cms-moderator-upgrade:
+
+
+CMS_MODERATOR
+=============
+Has been removed since it is no longer in use. From 2.4 onwards, all pages
+exist in a public and draft version. Users with the ``publish_page`` permission
+can publish changes to the public site.
+
+.. admonition:: Management command required
+
+ To bring a previous version of your site's database up-to-date, you'll need
+ to run ``manage.py moderator on``.
+
+
Added Fix MPTTT Management command
==================================
@@ -133,42 +200,11 @@ The following settings are not needed any more and have been removed:
Please remove them from your settings.py
-
-.. _migrations-upgrade:
-
-Migrations overhaul
-===================
-In version 2.4 migrations have been completely rewritten to fix issues with
-newer South releases.
-
-To ease upgrading process migration numbering and naming have not been changed,
-but only the first one for each application has actual migration code, so it's of
-utmost importance that you have an up to date migration history.
-
-To ensure this, when upgrading from 2.3.1 and older releases, please upgrate to
-2.3.3 first, execute all the migrations and then move to 2.4.
-
-For the two step upgrade process do the following in your project main directory ::
-
- pip install django-cms==2.3.3
- python manage.py syncdb
- python manage.py migrate
- pip install django-cms==2.4
-
-
CMS_FLAT_URLS
=============
Was marked deprecated in 2.3 and has now been removed.
-CMS_MODERATOR
-=============
-Has been removed since it is no longer in use. From 2.4 onwards, all pages
-exist in a public and draft version. Users with the ``publish_page`` permission
-can publish changes to the public site.
-
-To ensure that a site that was set up using a previous version is up to date,
-run ``manage.py moderator on``.
Plugins in Plugins

0 comments on commit 2d18600

Please sign in to comment.