本文整理匯總了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)))