Cleanups
This commit is contained in:
@@ -14,17 +14,13 @@ from django.utils.http import urlencode
|
|||||||
|
|
||||||
from elementtree.ElementTree import Element, SubElement
|
from elementtree.ElementTree import Element, SubElement
|
||||||
|
|
||||||
#from common.utils import urlquote
|
|
||||||
|
|
||||||
from .utils import (resolve_to_name, resolve_arguments,
|
from .utils import (resolve_to_name, resolve_arguments,
|
||||||
resolve_template_variable, get_navigation_objects)
|
resolve_template_variable, get_navigation_objects)
|
||||||
from . import main_menu
|
from . import main_menu
|
||||||
|
|
||||||
object_navigation = {}
|
|
||||||
multi_object_navigation = {}
|
multi_object_navigation = {}
|
||||||
model_list_columns = {}
|
model_list_columns = {}
|
||||||
sidebar_templates = {}
|
sidebar_templates = {}
|
||||||
top_menu_entries = []
|
|
||||||
|
|
||||||
link_binding = {}
|
link_binding = {}
|
||||||
|
|
||||||
@@ -156,7 +152,6 @@ class Link(object):
|
|||||||
resolved_link.active = True
|
resolved_link.active = True
|
||||||
|
|
||||||
return resolved_link
|
return resolved_link
|
||||||
#context_links.append(new_link)
|
|
||||||
|
|
||||||
|
|
||||||
def bind_links(sources, links, menu_name=None, position=0):
|
def bind_links(sources, links, menu_name=None, position=0):
|
||||||
@@ -201,21 +196,15 @@ def register_sidebar_template(source_list, template_name):
|
|||||||
sidebar_templates[source].append(template_name)
|
sidebar_templates[source].append(template_name)
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
def register_multi_item_links(sources, links, menu_name=None):
|
||||||
def register_multi_item_links(src, links, menu_name=None):
|
|
||||||
"""
|
"""
|
||||||
Register a multiple item action action to be displayed in the
|
Register a multiple item action action to be displayed in the
|
||||||
generic list template
|
generic list template
|
||||||
"""
|
"""
|
||||||
# TODO: simplify by removing __iter__ support
|
|
||||||
multi_object_navigation.setdefault(menu_name, {})
|
multi_object_navigation.setdefault(menu_name, {})
|
||||||
if hasattr(src, '__iter__'):
|
for source in sources:
|
||||||
for one_src in src:
|
multi_object_navigation[menu_name].setdefault(source, {'links': []})
|
||||||
multi_object_navigation[menu_name].setdefault(one_src, {'links': []})
|
multi_object_navigation[menu_name][source]['links'].extend(links)
|
||||||
multi_object_navigation[menu_name][one_src]['links'].extend(links)
|
|
||||||
else:
|
|
||||||
multi_object_navigation[menu_name].setdefault(src, {'links': []})
|
|
||||||
multi_object_navigation[menu_name][src]['links'].extend(links)
|
|
||||||
|
|
||||||
|
|
||||||
def get_context_object_navigation_links(context, menu_name=None, links_dict=link_binding):
|
def get_context_object_navigation_links(context, menu_name=None, links_dict=link_binding):
|
||||||
@@ -227,11 +216,6 @@ def get_context_object_navigation_links(context, menu_name=None, links_dict=link
|
|||||||
# Don't fudge with the original global dictionary
|
# Don't fudge with the original global dictionary
|
||||||
links_dict = links_dict.copy()
|
links_dict = links_dict.copy()
|
||||||
|
|
||||||
# Preserve unicode data in URL query
|
|
||||||
#previous_path = smart_unicode(urllib.unquote_plus(smart_str(request.get_full_path()) or smart_str(request.META.get('HTTP_REFERER', u'/'))))
|
|
||||||
#query_string = urlparse.urlparse(previous_path).query
|
|
||||||
#parsed_query_string = urlparse.parse_qs(query_string)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
"""
|
"""
|
||||||
Override the navigation links dictionary with the provided
|
Override the navigation links dictionary with the provided
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from django.utils.encoding import smart_str, force_unicode, smart_unicode
|
|||||||
from common.utils import urlquote
|
from common.utils import urlquote
|
||||||
|
|
||||||
from ..api import (link_binding, multi_object_navigation,
|
from ..api import (link_binding, multi_object_navigation,
|
||||||
top_menu_entries, sidebar_templates, get_context_object_navigation_links)
|
sidebar_templates, get_context_object_navigation_links)
|
||||||
from ..forms import MultiItemForm
|
from ..forms import MultiItemForm
|
||||||
from ..utils import (resolve_to_name, resolve_arguments, resolve_template_variable,
|
from ..utils import (resolve_to_name, resolve_arguments, resolve_template_variable,
|
||||||
get_navigation_objects)
|
get_navigation_objects)
|
||||||
|
|||||||
Reference in New Issue
Block a user