本文整理汇总了Python中django.views.generic.View.dispatch方法的典型用法代码示例。如果您正苦于以下问题:Python View.dispatch方法的具体用法?Python View.dispatch怎么用?Python View.dispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.views.generic.View
的用法示例。
在下文中一共展示了View.dispatch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dispatch
# 需要导入模块: from django.views.generic import View [as 别名]
# 或者: from django.views.generic.View import dispatch [as 别名]
def dispatch(self, request, *args, **kwargs):
# Authentication
if not users.get_current_user().email() in settings.AUTHORIZED_USER:
if not 'localhost' == request.META['SERVER_NAME']:
if not 0 == len(settings.AUTHORIZED_USER):
return HttpResponse(status=403)
return View.dispatch(self, request, *args, **kwargs)
示例2: dispatch
# 需要导入模块: from django.views.generic import View [as 别名]
# 或者: from django.views.generic.View import dispatch [as 别名]
def dispatch(self, request, *args, **kwargs):
if not self.has_permission(request, *args, **kwargs):
if not request.user.is_authenticated():
path = request.get_full_path()
return HttpResponseRedirect("%s?next=%s" % (settings.LOGIN_URL,
path))
else:
return render_to_forbidden(request)
return _View.dispatch(self, request, *args, **kwargs)
示例3: dispatch
# 需要导入模块: from django.views.generic import View [as 别名]
# 或者: from django.views.generic.View import dispatch [as 别名]
def dispatch(self, request, *args, **kwargs):
return View.dispatch(self, request, *args, **kwargs)