Merge branch 'release/0.8.x' into develop
This commit is contained in:
commit
baa3eccab9
|
@ -34,6 +34,15 @@ Implement Features
|
|||
Look through the GitHub issues for features. Anything tagged with "feature"
|
||||
is open to whoever wants to implement it.
|
||||
|
||||
Branching model
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
When planning a code cotnribution, these is the project branching model:
|
||||
|
||||
* new features goes to develop
|
||||
* bugfixes for releases goes to release/Y.Z.x branches
|
||||
* master is just a snapshot of the latest stable release and should not be targeted
|
||||
|
||||
Write Documentation
|
||||
===================
|
||||
|
||||
|
@ -81,7 +90,11 @@ tests, including testing other Python versions with tox::
|
|||
|
||||
$ tox
|
||||
|
||||
<<<<<<< HEAD
|
||||
To get tox, just pip install them into your virtualenv.
|
||||
=======
|
||||
To get flake8 and tox, just pip install them into your virtualenv.
|
||||
>>>>>>> release/0.8.x
|
||||
|
||||
6. Commit your changes and push your branch to GitHub::
|
||||
|
||||
|
@ -101,7 +114,7 @@ Before you submit a pull request, check that it meets these guidelines:
|
|||
2. If the pull request adds functionality, the docs should be updated. Put
|
||||
your new functionality into a function with a docstring, and add the
|
||||
feature to the list in README.rst.
|
||||
3. The pull request should work for Python 2.7, 3.4, and 3.5. Check
|
||||
3. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6. Check
|
||||
https://travis-ci.org/nephila/djangocms-blog/pull_requests
|
||||
and make sure that the tests pass for all supported Python versions.
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ History
|
|||
|
||||
|
||||
*******************
|
||||
0.8.13 (unreleased)
|
||||
0.8.13 (2017-07-25)
|
||||
*******************
|
||||
|
||||
* Drop python 2.6 compatibility
|
||||
* Dropped python 2.6 compatibility
|
||||
* Fixed exceptions in __str__
|
||||
* Drop python 2.6 compatibility
|
||||
* Fixed issue with duplicated categories in menu
|
||||
|
||||
*******************
|
||||
0.8.12 (2017-03-11)
|
||||
|
|
|
@ -105,6 +105,7 @@ HELPER_SETTINGS = dict(
|
|||
}
|
||||
},
|
||||
BLOG_AUTO_SETUP=False,
|
||||
ALLOWED_HOSTS=['*'],
|
||||
)
|
||||
|
||||
try:
|
||||
|
|
|
@ -3,6 +3,6 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|||
|
||||
__author__ = 'Iacopo Spalletti'
|
||||
__email__ = 'i.spalletti@nephila.it'
|
||||
__version__ = '0.9b9'
|
||||
__version__ = '0.9b10'
|
||||
|
||||
default_app_config = 'djangocms_blog.apps.BlogAppConfig'
|
||||
|
|
|
@ -48,6 +48,13 @@ class BlogCategoryMenu(CMSAttachMenu):
|
|||
namespace=self.instance.application_namespace
|
||||
)
|
||||
config = self._config[self.instance.application_namespace]
|
||||
if hasattr(self, 'instance') and self.instance:
|
||||
if not getattr(request, 'toolbar', False) or not request.toolbar.edit_mode:
|
||||
if self.instance == self.instance.get_draft_object():
|
||||
return []
|
||||
else:
|
||||
if self.instance == self.instance.get_public_object():
|
||||
return []
|
||||
if config and config.menu_structure in (MENU_TYPE_COMPLETE, MENU_TYPE_CATEGORIES):
|
||||
categories_menu = True
|
||||
if config and config.menu_structure in (MENU_TYPE_COMPLETE, MENU_TYPE_POSTS):
|
||||
|
@ -86,23 +93,28 @@ class BlogCategoryMenu(CMSAttachMenu):
|
|||
if config:
|
||||
categories = categories.namespace(self.instance.application_namespace)
|
||||
if config and not config.menu_empty_categories:
|
||||
categories = categories.filter(pk__in=used_categories)
|
||||
categories = categories.active_translations(language).filter(
|
||||
pk__in=used_categories
|
||||
).distinct()
|
||||
else:
|
||||
categories = categories.active_translations(language).distinct()
|
||||
categories = categories.order_by('parent__id', 'translations__name').\
|
||||
select_related('app_config').prefetch_related('translations')
|
||||
added_categories = []
|
||||
for category in categories:
|
||||
node = NavigationNode(
|
||||
category.name,
|
||||
category.get_absolute_url(),
|
||||
'{0}-{1}'.format(category.__class__.__name__, category.pk),
|
||||
(
|
||||
'{0}-{1}'.format(
|
||||
category.__class__.__name__, category.parent.id
|
||||
) if category.parent else None
|
||||
if category.pk not in added_categories:
|
||||
node = NavigationNode(
|
||||
category.name,
|
||||
category.get_absolute_url(),
|
||||
'{0}-{1}'.format(category.__class__.__name__, category.pk),
|
||||
(
|
||||
'{0}-{1}'.format(
|
||||
category.__class__.__name__, category.parent.id
|
||||
) if category.parent else None
|
||||
)
|
||||
)
|
||||
)
|
||||
nodes.append(node)
|
||||
nodes.append(node)
|
||||
added_categories.append(category.pk)
|
||||
|
||||
return nodes
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.utils.translation import activate
|
|||
from menus.menu_pool import menu_pool
|
||||
from parler.utils.context import smart_override, switch_language
|
||||
|
||||
from djangocms_blog.models import BlogCategory
|
||||
from djangocms_blog.settings import (
|
||||
MENU_TYPE_CATEGORIES, MENU_TYPE_COMPLETE, MENU_TYPE_NONE, MENU_TYPE_POSTS,
|
||||
)
|
||||
|
@ -46,9 +47,10 @@ class MenuTest(BaseTest):
|
|||
for lang in ('en', 'it'):
|
||||
with smart_override(lang):
|
||||
self._reset_menus()
|
||||
request = self.get_page_request(pages[1], self.user, pages[1].get_absolute_url(lang))
|
||||
request = self.get_page_request(pages[1], self.user, pages[1].get_absolute_url(lang), edit=True)
|
||||
nodes = menu_pool.get_nodes(request)
|
||||
nodes_url = set([node.url for node in nodes])
|
||||
self.assertTrue(len(nodes), BlogCategory.objects.all().count() + len(pages))
|
||||
nodes_url = set([node.get_absolute_url() for node in nodes])
|
||||
cats_url = set([cat.get_absolute_url() for cat in self.cats if cat.has_translation(lang)])
|
||||
self.assertTrue(cats_url.issubset(nodes_url))
|
||||
|
||||
|
@ -57,9 +59,11 @@ class MenuTest(BaseTest):
|
|||
for lang in ('en', 'it'):
|
||||
with smart_override(lang):
|
||||
self._reset_menus()
|
||||
request = self.get_page_request(pages[1], self.user, pages[1].get_absolute_url(lang))
|
||||
request = self.get_page_request(pages[1].get_draft_object(), self.user, pages[1].get_draft_object().get_absolute_url(lang))
|
||||
nodes = menu_pool.get_nodes(request)
|
||||
nodes_url = set([node.url for node in nodes])
|
||||
urls = [node.get_absolute_url() for node in nodes]
|
||||
nodes_url = [node.get_absolute_url() for node in nodes]
|
||||
self.assertTrue(len(nodes_url), BlogCategory.objects.all().count() + len(pages))
|
||||
self.assertFalse(posts[0].get_absolute_url(lang) in nodes_url)
|
||||
self.assertTrue(posts[1].get_absolute_url(lang) in nodes_url)
|
||||
|
||||
|
@ -94,7 +98,7 @@ class MenuTest(BaseTest):
|
|||
with smart_override(lang):
|
||||
self._reset_menus()
|
||||
nodes = menu_pool.get_nodes(request)
|
||||
nodes_url = set([node.url for node in nodes])
|
||||
nodes_url = set([node.get_absolute_url() for node in nodes])
|
||||
self.assertFalse(cats_url[lang].issubset(nodes_url))
|
||||
self.assertFalse(posts_url[lang].issubset(nodes_url))
|
||||
|
||||
|
@ -107,7 +111,7 @@ class MenuTest(BaseTest):
|
|||
with smart_override(lang):
|
||||
self._reset_menus()
|
||||
nodes = menu_pool.get_nodes(request)
|
||||
nodes_url = set([node.url for node in nodes])
|
||||
nodes_url = set([node.get_absolute_url() for node in nodes])
|
||||
self.assertFalse(cats_url[lang].issubset(nodes_url))
|
||||
self.assertTrue(posts_url[lang].issubset(nodes_url))
|
||||
|
||||
|
@ -120,7 +124,7 @@ class MenuTest(BaseTest):
|
|||
with smart_override(lang):
|
||||
self._reset_menus()
|
||||
nodes = menu_pool.get_nodes(request)
|
||||
nodes_url = set([node.url for node in nodes])
|
||||
nodes_url = set([node.get_absolute_url() for node in nodes])
|
||||
self.assertTrue(cats_url[lang].issubset(nodes_url))
|
||||
self.assertFalse(posts_url[lang].issubset(nodes_url))
|
||||
|
||||
|
@ -133,7 +137,7 @@ class MenuTest(BaseTest):
|
|||
with smart_override(lang):
|
||||
self._reset_menus()
|
||||
nodes = menu_pool.get_nodes(request)
|
||||
nodes_url = set([node.url for node in nodes])
|
||||
nodes_url = set([node.get_absolute_url() for node in nodes])
|
||||
self.assertTrue(cats_url[lang].issubset(nodes_url))
|
||||
self.assertTrue(posts_url[lang].issubset(nodes_url))
|
||||
|
||||
|
|
Loading…
Reference in New Issue