本文整理汇总了Python中django.views.generic.FormView.dispatch方法的典型用法代码示例。如果您正苦于以下问题:Python FormView.dispatch方法的具体用法?Python FormView.dispatch怎么用?Python FormView.dispatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.views.generic.FormView
的用法示例。
在下文中一共展示了FormView.dispatch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dispatch
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import dispatch [as 别名]
def dispatch(self, request, *args, **kwargs):
""" Override dispatch to do some checks before displaying form """
# quick hack to show sample customer response form with known test win
if request.path.endswith('sample/'):
kwargs['win_id'] = os.getenv('SAMPLE_WIN', 'notconfigured')
self.kwargs['win_id'] = kwargs['win_id']
self.sample = True
try:
self.win_dict = self._get_valid_win(kwargs["win_id"], request)
except self.SecurityException as e:
return self._deny_access(request, message=str(e))
return FormView.dispatch(self, request, *args, **kwargs)
示例2: dispatch
# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import dispatch [as 别名]
def dispatch(self, request, *args, **kwargs):
return FormView.dispatch(self, request, *args, **kwargs)