Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Apr 10, 2015
2 parents ea14d11 + 5056fa2 commit 1de0202
Show file tree
Hide file tree
Showing 409 changed files with 10,870 additions and 7,129 deletions.
4 changes: 2 additions & 2 deletions .coverage.rc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ source =
branch = False
omit =
cms/migrations/*
cms/migrations_django/*
cms/south_migrations/*
cms/tests/*
cms/test_utils/*
menus/migrations/*
menus/migrations_django/*
menus/south_migrations/*
docs/*
env/*
env*
Expand Down
25 changes: 1 addition & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ env:
- SAUCE_USERNAME=digi604
- secure: NWiSBCHFB6LbTMget2qLIdqZlx0zeu3j+Y7Lsqb8kuYXyT2IUBGFVedcGWuGv/9Mzypb80EQWtVTokA3/3QIbesqr29uG95pMPHiYWLdnTO6UHcLMcNXiSzhBGdRDZ40iHSVv2dDHs4GNwGOH5+UCA0z3j7SWmChuFbNXh+Vsqw=
matrix:
- DJANGO=1.4 DATABASE_URL='sqlite://localhost/:memory:' SELENIUM=0
- DJANGO=1.4 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- DJANGO=1.4 DATABASE_URL='postgres://[email protected]/djangocms_test' SELENIUM=1
- DJANGO=1.5 DATABASE_URL='sqlite://localhost/:memory:' SELENIUM=0
- DJANGO=1.5 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- DJANGO=1.5 DATABASE_URL='postgres://[email protected]/djangocms_test' SELENIUM=0
- DJANGO=1.5 DATABASE_URL='postgres://[email protected]/djangocms_test' SELENIUM=1 AUTH_USER_MODEL='emailuserapp.EmailUser'
- DJANGO=1.6 DATABASE_URL='sqlite://localhost/:memory:' SELENIUM=0
- DJANGO=1.6 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- DJANGO=1.6 DATABASE_URL='postgres://[email protected]/djangocms_test' SELENIUM=0
Expand Down Expand Up @@ -48,7 +41,7 @@ install:

script: coverage run --rcfile=.coverage.rc develop.py test --migrate

after_success: coveralls --config_file=.coverage.rc --coveralls_yaml=.coveralls.yml
after_success: coveralls --config_file=.coverage.rc

notifications:
email:
Expand All @@ -72,31 +65,15 @@ matrix:
- python: 2.6
env: DJANGO=1.7 DATABASE_URL='postgres://[email protected]/djangocms_test' SELENIUM=1 AUTH_USER_MODEL='emailuserapp.EmailUser'

- python: 3.3
env: DJANGO=1.4 DATABASE_URL='sqlite://localhost/:memory:' SELENIUM=0
- python: 3.3
env: DJANGO=1.4 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- python: 3.3
env: DJANGO=1.5 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- python: 3.3
env: DJANGO=1.6 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- python: 3.3
env: DJANGO=1.7 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- python: 3.3
env: DJANGO=1.4 DATABASE_URL='postgres://[email protected]/djangocms_test' SELENIUM=1

- python: 3.4
env: DJANGO=1.4 DATABASE_URL='sqlite://localhost/:memory:' SELENIUM=0
- python: 3.4
env: DJANGO=1.4 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- python: 3.4
env: DJANGO=1.5 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- python: 3.4
env: DJANGO=1.6 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- python: 3.4
env: DJANGO=1.7 DATABASE_URL='mysql://[email protected]/djangocms_test' SELENIUM=0
- python: 3.4
env: DJANGO=1.4 DATABASE_URL='postgres://[email protected]/djangocms_test' SELENIUM=1

allow_failures:
- python: 2.7
Expand Down
12 changes: 10 additions & 2 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ Please see Install/2.4 release notes *before* attempting to upgrade to version 2
- Added list of retired core developers
- Added branch policy documentaion

=== 3.0.8 (2015-01-11) ===
==== 3.0.8 (2015-01-11) ===
- Add require_parent option to CMS_PLACEHOLDER_CONF
- Fix django-mptt version depenency to be PEP440 compatible
- Fix some Django 1.4 compatibility issues
Expand All @@ -306,7 +306,7 @@ Please see Install/2.4 release notes *before* attempting to upgrade to version 2
- Documentation fixes
- Minor code cleanups

=== 3.0.9 (2015-01-11) ===
==== 3.0.9 (2015-01-11) ===
- Revert a change that caused a regression in toolbar login
- Fix an error in a translated phrase
- Fix error when moving items in the page tree
Expand Down Expand Up @@ -344,3 +344,11 @@ Please see Install/2.4 release notes *before* attempting to upgrade to version 2

- Fixed a typo in JavaScript which prevents page tree from working

==== 3.1 (unreleased) ===

- Remove django-mptt in favor of django-treebeard
- Remove compatibility with Django 1.4 / 1.5
- General code cleanup
- Simplify loading of view restrictions in the menu
- south is not marked as optional; to use south on Django 1.6 install django-cms[south]
- Add system_plugin attribute to CMSPluginBase that allow the plugin to override any configuration
21 changes: 14 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@ django CMS
##########
.. image:: https://travis-ci.org/divio/django-cms.svg?branch=support%2F3.0.x
:target: http://travis-ci.org/divio/django-cms
.. image:: https://pypip.in/v/django-cms/badge.svg
.. image:: https://pypip.in/v/django-cms/badge.svg?style=flat
:target: https://pypi.python.org/pypi/django-cms/
.. image:: https://pypip.in/d/django-cms/badge.svg
.. image:: https://pypip.in/d/django-cms/badge.svg?style=flat
:target: https://pypi.python.org/pypi/django-cms/
.. image:: https://pypip.in/wheel/django-cms/badge.svg
.. image:: https://pypip.in/wheel/django-cms/badge.svg?style=flat
:target: https://pypi.python.org/pypi/django-cms/
.. image:: https://pypip.in/license/django-cms/badge.svg
.. image:: https://pypip.in/license/django-cms/badge.svg?style=flat
:target: https://pypi.python.org/pypi/django-cms/


Open source enterprise content management system based on the django framework.

.. ATTENTION:: This is the **develop** branch. It's the branch for features that
will go into django CMS 3.1. The **master** branch is the current stable release,
the one released on PyPI.

**support/3.0.x** will be our *next stable release*, the most
appropriate branch for fixes and patches that will go into the next **master**.

********
Features
********
Expand All @@ -37,11 +44,11 @@ You can define editable areas, called placeholders, in your templates which you
with many different so called CMS content plugins.
A list of all the plugins can be found here:

`3rd party plugins <http://www.djangopackages.com/grids/g/django-cms/>`_
`3rd party plugins <http://www.djangopackages.com/grids/g/django-cms/>`_

Should you be unable to find a suitable plugin for you needs, writing your own is very simple.

More information on `our website <http://www.django-cms.org>`_.
More information on `our website <http://www.django-cms.org>`_.

*************
Documentation
Expand Down Expand Up @@ -82,7 +89,7 @@ Credits

* Includes icons from `FamFamFam <http://www.famfamfam.com>`_.
* Python tree engine powered by
`django-mptt <https://github.com/django-mptt/django-mptt>`_.
`django-treebeard <https://tabo.pe/projects/django-treebeard/>`_.
* Javascript tree in admin uses `jsTree <http://www.jstree.com>`_.
* Many thanks to the
`over 250 contributors <https://github.com/divio/django-cms/blob/master/AUTHORS>`_
Expand Down
2 changes: 1 addition & 1 deletion cms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
__version__ = '3.0.12'
__version__ = '3.1.0.b1'

default_app_config = 'cms.apps.CMSConfig'
60 changes: 28 additions & 32 deletions cms/admin/change_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
import bisect
from cms.models import Title, Page, EmptyTitle
from cms.utils import get_language_list
from cms.utils.compat import DJANGO_1_5
from cms.utils.conf import get_cms_setting
from cms.utils.permissions import get_user_sites_queryset
from cms.utils.permissions import get_user_sites_queryset, load_view_restrictions
from django.contrib.admin.views.main import ChangeList, ALL_VAR, IS_POPUP_VAR, \
ORDER_TYPE_VAR, ORDER_VAR, SEARCH_VAR
from django.contrib.sites.models import Site
import django


COPY_VAR = "copy"

Expand All @@ -20,7 +19,7 @@ def cache_tree_children(queryset):
item, which would otherwise (if '_cached_children' is not set) cause a
database query.
The queryset must be ordered by 'lft', or the function will put the children
The queryset must be ordered by 'path', or the function will put the children
in the wrong order.
"""
parents_dict = {}
Expand All @@ -46,11 +45,12 @@ class CMSChangeList(ChangeList):
real_queryset = False

def __init__(self, request, *args, **kwargs):
from cms.utils.plugins import current_site
from cms.utils.helpers import current_site

self._current_site = current_site(request)
super(CMSChangeList, self).__init__(request, *args, **kwargs)
try:
self.queryset = self.get_query_set(request)
self.queryset = self.get_queryset(request)
except:
raise
self.get_results(request)
Expand All @@ -59,32 +59,25 @@ def __init__(self, request, *args, **kwargs):
request.session['cms_admin_site'] = self._current_site.pk
self.set_sites(request)

def get_query_set(self, request=None):
def get_queryset(self, request):
if COPY_VAR in self.params:
del self.params[COPY_VAR]
if 'language' in self.params:
del self.params['language']
if 'page_id' in self.params:
del self.params['page_id']
if django.VERSION[1] > 3:
qs = super(CMSChangeList, self).get_query_set(request).drafts()
else:
qs = super(CMSChangeList, self).get_query_set().drafts()
if request:
site = self.current_site()
permissions = Page.permissions.get_change_id_list(request.user, site)
if permissions != Page.permissions.GRANT_ALL:
qs = qs.filter(pk__in=permissions)
# root_query_set is a read-only property in Django 1.6
# and will be removed in Django 1.8.
queryset_attr = 'root_query_set' if DJANGO_1_5 else 'root_queryset'
setattr(self, queryset_attr, self.root_query_set.filter(pk__in=permissions))
self.real_queryset = True
qs = qs.filter(site=self._current_site)
qs = super(CMSChangeList, self).get_queryset(request).drafts()
site = self.current_site()
permissions = Page.permissions.get_change_id_list(request.user, site)
if permissions != Page.permissions.GRANT_ALL:
qs = qs.filter(pk__in=permissions)
self.root_queryset = self.root_queryset.filter(pk__in=permissions)
self.real_queryset = True
qs = qs.filter(site=self._current_site)
return qs

def is_filtered(self):
from cms.utils.plugins import SITE_VAR
from cms.utils.helpers import SITE_VAR
lookup_params = self.params.copy() # a dictionary of the query string
for i in (ALL_VAR, ORDER_VAR, ORDER_TYPE_VAR, SEARCH_VAR, IS_POPUP_VAR, SITE_VAR, 'language', 'page_id'):
if i in lookup_params:
Expand All @@ -97,15 +90,15 @@ def get_results(self, request):
if self.real_queryset:
super(CMSChangeList, self).get_results(request)
if not self.is_filtered():
self.full_result_count = self.result_count = self.root_query_set.count()
self.full_result_count = self.result_count = self.root_queryset.count()
else:
self.full_result_count = self.root_query_set.count()
self.full_result_count = self.root_queryset.count()

def set_items(self, request):
site = self.current_site()
# Get all the pages, ordered by tree ID (it's convenient to build the
# tree using a stack now)
pages = self.get_query_set(request).drafts().order_by('tree_id', 'lft').select_related('publisher_public')
pages = self.get_queryset(request).drafts().order_by('path').select_related('publisher_public')

# Get lists of page IDs for which the current user has
# "permission to..." on the current site.
Expand All @@ -118,19 +111,22 @@ def set_items(self, request):
pages = pages.filter(pk__in=perm_edit_ids)

root_pages = []
# Cache view restrictions for the is_restricted template tag
load_view_restrictions(request, pages)
pages = list(pages)
all_pages = pages[:] # That is, basically, a copy.

# Unfortunately we cannot use the MPTT builtin code for pre-caching
# the children here, because MPTT expects the tree to be 'complete'
# and otherwise complaints about 'invalid item order'
cache_tree_children(pages)
ids = dict((page.id, page) for page in pages)

parent_ids = {}
for page in pages:

children = list(page.get_children())

if not page.parent_id in parent_ids:
parent_ids[page.parent_id] = []
parent_ids[page.parent_id].append(page)
for page in pages:
children = parent_ids.get(page.pk, [])
# If the parent page is not among the nodes shown, this node should
# be a "root node". The filtering for this has already been made, so
# using the ids dictionary means this check is constant time
Expand All @@ -154,7 +150,7 @@ def set_items(self, request):
page.menu_level = 0
root_pages.append(page)
if page.parent_id:
page.get_cached_ancestors(ascending=True)
page.get_cached_ancestors()
else:
page.ancestors_ascending = []

Expand Down
Loading

0 comments on commit 1de0202

Please sign in to comment.