diff --git a/wagtail/wagtailadmin/edit_handlers.py b/wagtail/wagtailadmin/edit_handlers.py index 2b4006610..a15440016 100644 --- a/wagtail/wagtailadmin/edit_handlers.py +++ b/wagtail/wagtailadmin/edit_handlers.py @@ -19,7 +19,7 @@ from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_lazy from wagtail.wagtailcore.models import Page -from wagtail.wagtailcore.util import camelcase_to_underscore +from wagtail.wagtailcore.utils import camelcase_to_underscore from wagtail.wagtailcore.fields import RichTextArea diff --git a/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py b/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py index 2d85c355e..9f03c7b63 100644 --- a/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py +++ b/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py @@ -6,7 +6,7 @@ from wagtail.wagtailadmin import hooks from wagtail.wagtailadmin.menu import MenuItem from wagtail.wagtailcore.models import get_navigation_menu_items, UserPagePermissionsProxy -from wagtail.wagtailcore.util import camelcase_to_underscore +from wagtail.wagtailcore.utils import camelcase_to_underscore register = template.Library() diff --git a/wagtail/wagtailcore/models.py b/wagtail/wagtailcore/models.py index 5c3f9d1c5..1f0c98d83 100644 --- a/wagtail/wagtailcore/models.py +++ b/wagtail/wagtailcore/models.py @@ -18,7 +18,7 @@ from django.utils.translation import ugettext_lazy as _ from treebeard.mp_tree import MP_Node -from wagtail.wagtailcore.util import camelcase_to_underscore +from wagtail.wagtailcore.utils import camelcase_to_underscore from wagtail.wagtailcore.query import PageQuerySet from wagtail.wagtailsearch import Indexed, get_search_backend @@ -126,56 +126,56 @@ def get_navigable_page_content_type_ids(): class PageManager(models.Manager): - def get_query_set(self): + def get_queryset(self): return PageQuerySet(self.model).order_by('path') def live(self): - return self.get_query_set().live() + return self.get_queryset().live() def not_live(self): - return self.get_query_set().not_live() + return self.get_queryset().not_live() def page(self, other): - return self.get_query_set().page(other) + return self.get_queryset().page(other) def not_page(self, other): - return self.get_query_set().not_page(other) + return self.get_queryset().not_page(other) def descendant_of(self, other, inclusive=False): - return self.get_query_set().descendant_of(other, inclusive) + return self.get_queryset().descendant_of(other, inclusive) def not_descendant_of(self, other, inclusive=False): - return self.get_query_set().not_descendant_of(other, inclusive) + return self.get_queryset().not_descendant_of(other, inclusive) def child_of(self, other): - return self.get_query_set().child_of(other) + return self.get_queryset().child_of(other) def not_child_of(self, other): - return self.get_query_set().not_child_of(other) + return self.get_queryset().not_child_of(other) def ancestor_of(self, other, inclusive=False): - return self.get_query_set().ancestor_of(other, inclusive) + return self.get_queryset().ancestor_of(other, inclusive) def not_ancestor_of(self, other, inclusive=False): - return self.get_query_set().not_ancestor_of(other, inclusive) + return self.get_queryset().not_ancestor_of(other, inclusive) def parent_of(self, other): - return self.get_query_set().parent_of(other) + return self.get_queryset().parent_of(other) def not_parent_of(self, other): - return self.get_query_set().not_parent_of(other) + return self.get_queryset().not_parent_of(other) def sibling_of(self, other, inclusive=False): - return self.get_query_set().sibling_of(other, inclusive) + return self.get_queryset().sibling_of(other, inclusive) def not_sibling_of(self, other, inclusive=False): - return self.get_query_set().not_sibling_of(other, inclusive) + return self.get_queryset().not_sibling_of(other, inclusive) def type(self, model): - return self.get_query_set().type(model) + return self.get_queryset().type(model) def not_type(self, model): - return self.get_query_set().not_type(model) + return self.get_queryset().not_type(model) class PageBase(models.base.ModelBase): @@ -697,8 +697,8 @@ class Orderable(models.Model): class SubmittedRevisionsManager(models.Manager): - def get_query_set(self): - return super(SubmittedRevisionsManager, self).get_query_set().filter(submitted_for_moderation=True) + def get_queryset(self): + return super(SubmittedRevisionsManager, self).get_queryset().filter(submitted_for_moderation=True) class PageRevision(models.Model): diff --git a/wagtail/wagtailcore/util.py b/wagtail/wagtailcore/util.py index c5ad7ea8d..842fe24fa 100644 --- a/wagtail/wagtailcore/util.py +++ b/wagtail/wagtailcore/util.py @@ -1,6 +1,7 @@ -import re +import warnings +warnings.warn( + "The wagtail.wagtailcore.util module has been renamed. " + "Use wagtail.wagtailcore.utils instead.", DeprecationWarning) -def camelcase_to_underscore(str): - # http://djangosnippets.org/snippets/585/ - return re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', '_\\1', str).lower().strip('_') +from .utils import * diff --git a/wagtail/wagtailcore/utils.py b/wagtail/wagtailcore/utils.py new file mode 100644 index 000000000..c5ad7ea8d --- /dev/null +++ b/wagtail/wagtailcore/utils.py @@ -0,0 +1,6 @@ +import re + + +def camelcase_to_underscore(str): + # http://djangosnippets.org/snippets/585/ + return re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', '_\\1', str).lower().strip('_')