Skip to content

Commit

Permalink
Added IGNORE_ADMIN_APP to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkadiusz Adamski committed Dec 7, 2015
1 parent d0b8f40 commit 7851bea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sitetree/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# Cache is only invalidated on sitetree or sitetree item change.
CACHE_TIMEOUT = getattr(settings, 'SITETREE_CACHE_TIMEOUT', 31536000)

IGNORE_ADMIN_APP = getattr(settings, 'SITETREE_IGNORE_ADMIN_APP', False)

# Reserved tree items aliases.
ALIAS_TRUNK = 'trunk'
ALIAS_THIS_CHILDREN = 'this-children'
Expand Down
4 changes: 3 additions & 1 deletion sitetree/sitetreeapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .utils import get_tree_model, get_tree_item_model, import_app_sitetree_module, generate_id_for
from .settings import (
ALIAS_TRUNK, ALIAS_THIS_CHILDREN, ALIAS_THIS_SIBLINGS, ALIAS_THIS_PARENT_SIBLINGS, ALIAS_THIS_ANCESTOR_CHILDREN,
UNRESOLVED_ITEM_MARKER, RAISE_ITEMS_ERRORS_ON_DEBUG, CACHE_TIMEOUT)
UNRESOLVED_ITEM_MARKER, RAISE_ITEMS_ERRORS_ON_DEBUG, CACHE_TIMEOUT, IGNORE_ADMIN_APP)


if VERSION >= (1, 9, 0):
Expand Down Expand Up @@ -410,6 +410,8 @@ def attach_dynamic_tree_items(tree_alias, src_tree_items):

def current_app_is_admin(self):
"""Returns boolean whether current application is Admin contrib."""
if IGNORE_ADMIN_APP:
return False
current_app = (
getattr(self._global_context.get('request', None), 'current_app',
self._global_context.current_app))
Expand Down

0 comments on commit 7851bea

Please sign in to comment.