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