本文整理汇总了Python中django.template.context.Context.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Context.__init__方法的具体用法?Python Context.__init__怎么用?Python Context.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.template.context.Context
的用法示例。
在下文中一共展示了Context.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from django.template.context import Context [as 别名]
# 或者: from django.template.context.Context import __init__ [as 别名]
def __init__(self, dict, instance, placeholder, processors=None, current_app=None):
Context.__init__(self, dict, current_app=current_app)
if processors is None:
processors = ()
else:
processors = tuple(processors)
for processor in DEFAULT_PLUGIN_CONTEXT_PROCESSORS + get_standard_processors('CMS_PLUGIN_CONTEXT_PROCESSORS') + processors:
self.update(processor(instance, placeholder))
示例2: __init__
# 需要导入模块: from django.template.context import Context [as 别名]
# 或者: from django.template.context.Context import __init__ [as 别名]
def __init__(self, dict=None, processors=None, current_app=None):
Context.__init__(self, dict, current_app=current_app)
if processors is None:
processors = ()
else:
processors = tuple(processors)
for processor in (
tuple(p for p in get_standard_processors() if getattr(p, "requires_request", True) == False) + processors
):
self.update(processor())
示例3: __init__
# 需要导入模块: from django.template.context import Context [as 别名]
# 或者: from django.template.context.Context import __init__ [as 别名]
def __init__(self, request, dict=None, current_app=None):
# If there is any reason to site-global context processors for plugins,
# I'd like to know the usecase, and it could be implemented here.
if current_app is None:
# Avoid RemovedInDjango110Warning
Context.__init__(self, dict)
else:
Context.__init__(self, dict, current_app=current_app)
for processor in _STANDARD_REQUEST_CONTEXT_PROCESSORS:
self.update(processor(request))
示例4: __init__
# 需要导入模块: from django.template.context import Context [as 别名]
# 或者: from django.template.context.Context import __init__ [as 别名]
def __init__(self, request, dict=None, processors=None, current_app=None, use_l10n=None):
if not dict:
dict = {}
# 基础配置信息
configuration = Configuration.objects.filter()
if configuration:
dict['configuration'] = configuration[0]
# ‘公共’尾部信息
foot_items = FootItem.objects.filter(is_display=True).order_by('order')
if foot_items:
dict['foot_items'] = foot_items
Context.__init__(self, dict, current_app=current_app, use_l10n=use_l10n)
if processors is None:
processors = ()
else:
processors = tuple(processors)
for processor in get_standard_processors() + processors:
self.update(processor(request))