generic.views module

class generic.views.Index(**kwargs)[源代码]

基类:SecureTemplateView

dispatch_prepare(method: str) Callable[[], HttpResponse][源代码]

每个方法执行前的准备工作,返回重定向的方法

准备方法的约定以当前类PrepareType为准,PrepareType包含None的可只实现处理方法 SecureView要求必须实现准备方法,子类如果准备方法命名错误未调用则无法提供错误信息 子类建议使用match语句,不存在时可调用`default_prepare`

ip_check() None[源代码]
login() HttpResponse[源代码]
login_required: bool = False
prepare_login() Callable[[], HttpResponse][源代码]
template_name: str = 'index.html'
user_get() HttpResponse[源代码]
valid_user_check(user: User)[源代码]
visitor_get() HttpResponse[源代码]
class generic.views.Logout(**kwargs)[源代码]

基类:SecureView

dispatch_prepare(method: str) Callable[[], HttpResponse][源代码]

每个方法执行前的准备工作,返回重定向的方法

准备方法的约定以当前类PrepareType为准,PrepareType包含None的可只实现处理方法 SecureView要求必须实现准备方法,子类如果准备方法命名错误未调用则无法提供错误信息 子类建议使用match语句,不存在时可调用`default_prepare`

get() HttpResponse[源代码]
login_required: bool = False
generic.views.healthcheck(request: HttpRequest) HttpResponse[源代码]

django健康状态检查 尝试执行数据库操作,若成功返回200,不成功返回500