本文整理汇总了Python中xadmin.plugins.utils.get_context_dict方法的典型用法代码示例。如果您正苦于以下问题:Python utils.get_context_dict方法的具体用法?Python utils.get_context_dict怎么用?Python utils.get_context_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xadmin.plugins.utils
的用法示例。
在下文中一共展示了utils.get_context_dict方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: block_results_bottom
# 需要导入模块: from xadmin.plugins import utils [as 别名]
# 或者: from xadmin.plugins.utils import get_context_dict [as 别名]
def block_results_bottom(self, context, nodes):
if self.actions and self.admin_view.result_count:
nodes.append(loader.render_to_string('xadmin/blocks/model_list.results_bottom.actions.html',
context=get_context_dict(context)))
示例2: render
# 需要导入模块: from xadmin.plugins import utils [as 别名]
# 或者: from xadmin.plugins.utils import get_context_dict [as 别名]
def render(self, form, form_style, context, template_pack=TEMPLATE_PACK, **kwargs):
context = get_context_dict(context)
context.update(dict(
formset=self,
prefix=self.formset.prefix,
inline_style=self.inline_style,
**self.extra_attrs
))
return render_to_string(self.template, context)
示例3: block_nav_menu
# 需要导入模块: from xadmin.plugins import utils [as 别名]
# 或者: from xadmin.plugins.utils import get_context_dict [as 别名]
def block_nav_menu(self, context, nodes):
if self.has_filters:
nodes.append(loader.render_to_string('xadmin/blocks/model_list.nav_menu.filters.html',
context=get_context_dict(context)))
示例4: block_nav_form
# 需要导入模块: from xadmin.plugins import utils [as 别名]
# 或者: from xadmin.plugins.utils import get_context_dict [as 别名]
def block_nav_form(self, context, nodes):
if self.search_fields:
context = get_context_dict(context or {}) # no error!
context.update({
'search_var': SEARCH_VAR,
'remove_search_url': self.admin_view.get_query_string(remove=[SEARCH_VAR]),
'search_form_params': self.admin_view.get_form_params(remove=[SEARCH_VAR])
})
nodes.append(
loader.render_to_string(
'xadmin/blocks/model_list.nav_form.search_form.html',
context=context)
)
示例5: block_top_navmenu
# 需要导入模块: from xadmin.plugins import utils [as 别名]
# 或者: from xadmin.plugins.utils import get_context_dict [as 别名]
def block_top_navmenu(self, context, nodes):
context = get_context_dict(context)
context['redirect_to'] = self.request.get_full_path()
nodes.append(loader.render_to_string('xadmin/blocks/comm.top.setlang.html', context=context))
示例6: block_nav_menu
# 需要导入模块: from xadmin.plugins import utils [as 别名]
# 或者: from xadmin.plugins.utils import get_context_dict [as 别名]
def block_nav_menu(self, context, nodes):
if self.show_bookmarks:
nodes.insert(0, loader.render_to_string('xadmin/blocks/model_list.nav_menu.bookmarks.html',
context=get_context_dict(context)))
示例7: block_top_toolbar
# 需要导入模块: from xadmin.plugins import utils [as 别名]
# 或者: from xadmin.plugins.utils import get_context_dict [as 别名]
def block_top_toolbar(self, context, nodes):
has_change_perm = self.has_model_perm(self.model, 'change')
has_add_perm = self.has_model_perm(self.model, 'add')
if has_change_perm and has_add_perm:
model_info = (self.opts.app_label, self.opts.model_name)
import_url = reverse('xadmin:%s_%s_import' % model_info, current_app=self.admin_site.name)
context = get_context_dict(context or {}) # no error!
context.update({
'import_url': import_url,
})
nodes.append(loader.render_to_string('xadmin/blocks/model_list.top_toolbar.importexport.import.html',
context=context))
示例8: block_top_toolbar
# 需要导入模块: from xadmin.plugins import utils [as 别名]
# 或者: from xadmin.plugins.utils import get_context_dict [as 别名]
def block_top_toolbar(self, context, nodes):
if self.list_export:
context.update({
'show_export_all': self.admin_view.paginator.count > self.admin_view.list_per_page and not ALL_VAR in self.admin_view.request.GET,
'form_params': self.admin_view.get_form_params({'_do_': 'export'}, ('export_type',)),
'export_types': [{'type': et, 'name': self.export_names[et]} for et in self.list_export],
})
nodes.append(loader.render_to_string('xadmin/blocks/model_list.top_toolbar.exports.html',
context=get_context_dict(context)))
示例9: block_top_toolbar
# 需要导入模块: from xadmin.plugins import utils [as 别名]
# 或者: from xadmin.plugins.utils import get_context_dict [as 别名]
def block_top_toolbar(self, context, nodes):
if len(self._active_layouts) > 1:
context.update({
'layouts': self._active_layouts,
'current_icon': self._current_icon,
})
nodes.append(loader.render_to_string('xadmin/blocks/model_list.top_toolbar.layouts.html',
context=get_context_dict(context)))