本文整理匯總了Python中xadmin.util.quote方法的典型用法代碼示例。如果您正苦於以下問題:Python util.quote方法的具體用法?Python util.quote怎麽用?Python util.quote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xadmin.util
的用法示例。
在下文中一共展示了util.quote方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: block_nav_toggles
# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import quote [as 別名]
def block_nav_toggles(self, context, nodes):
obj = getattr(
self.admin_view, 'org_obj', getattr(self.admin_view, 'obj', None))
if obj:
revisionlist_url = self.admin_view.model_admin_url(
'revisionlist', quote(obj.pk))
nodes.append(mark_safe('<a href="%s" class="navbar-toggle pull-right"><i class="fa fa-calendar"></i></a>' % revisionlist_url))
示例2: block_nav_btns
# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import quote [as 別名]
def block_nav_btns(self, context, nodes):
obj = getattr(
self.admin_view, 'org_obj', getattr(self.admin_view, 'obj', None))
if obj:
revisionlist_url = self.admin_view.model_admin_url(
'revisionlist', quote(obj.pk))
nodes.append(mark_safe('<a href="%s" class="btn btn-default"><i class="fa fa-calendar"></i> <span>%s</span></a>' % (revisionlist_url, _(u'History'))))
# action revision
示例3: get_context
# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import quote [as 別名]
def get_context(self):
context = super(RevisionListView, self).get_context()
opts = self.opts
action_list = [
{
"revision": version.revision,
"url": self.model_admin_url('revision', quote(version.object_id), version.id),
"version": version
}
for version
in self._reversion_order_version_queryset(Version.objects.get_for_object_reference(
self.model,
self.obj.pk,
).select_related("revision__user"))
]
context.update({
'title': _('Change history: %s') % force_text(self.obj),
'action_list': action_list,
'model_name': capfirst(force_text(opts.verbose_name_plural)),
'object': self.obj,
'app_label': opts.app_label,
"changelist_url": self.model_admin_url("changelist"),
"update_url": self.model_admin_url("change", self.obj.pk),
'opts': opts,
})
return context
示例4: block_nav_toggles
# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import quote [as 別名]
def block_nav_toggles(self, context, nodes):
obj = getattr(
self.admin_view, 'org_obj', getattr(self.admin_view, 'obj', None))
if obj:
revisionlist_url = self.admin_view.model_admin_url(
'revisionlist', quote(obj.pk))
nodes.append(mark_safe('<a href="%s" class="navbar-toggle pull-right"><i class="fa fa-time"></i></a>' % revisionlist_url))
示例5: block_nav_btns
# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import quote [as 別名]
def block_nav_btns(self, context, nodes):
obj = getattr(
self.admin_view, 'org_obj', getattr(self.admin_view, 'obj', None))
if obj:
revisionlist_url = self.admin_view.model_admin_url(
'revisionlist', quote(obj.pk))
nodes.append(mark_safe('<a href="%s" class="btn btn-default"><i class="fa fa-time"></i> <span>%s</span></a>' % (revisionlist_url, _(u'History'))))
示例6: get_context
# 需要導入模塊: from xadmin import util [as 別名]
# 或者: from xadmin.util import quote [as 別名]
def get_context(self):
context = super(RevisionListView, self).get_context()
opts = self.opts
action_list = [
{
"revision": version.revision,
"url": self.model_admin_url('revision', quote(version.object_id), version.id),
"version": version
}
for version
in self._order_version_queryset(self.revision_manager.get_for_object_reference(
self.model,
self.obj.pk,
).select_related("revision__user"))
]
context.update({
'title': _('Change history: %s') % force_str(self.obj),
'action_list': action_list,
'model_name': capfirst(force_str(opts.verbose_name_plural)),
'object': self.obj,
'app_label': opts.app_label,
"changelist_url": self.model_admin_url("changelist"),
"update_url": self.model_admin_url("change", self.obj.pk),
'opts': opts,
})
return context