-
来自
:AuthenticationMiddleware的一个实例,代表当前的 logged-in 用户。如果用户当前未登录,AUTH_USER_MODELuser将设置为的实例。您可以使用AnonymousUser将它们区分开来,如下所示:is_authenticatedif request.user.is_authenticated: ... # Do something for logged-in users. else: ... # Do something for anonymous users.
本文介绍 django.http.HttpRequest.user 的用法。
声明
HttpRequest.user
相关用法
- Python Django HttpRequest.accepts用法及代码示例
- Python Django HttpRequest.headers用法及代码示例
- Python Django HttpRequest.get_signed_cookie用法及代码示例
- Python Django HttpRequest.method用法及代码示例
- Python Django HttpRequest.__iter__用法及代码示例
- Python Django HttpRequest.build_absolute_uri用法及代码示例
- Python Django Http404用法及代码示例
- Python calendar HTMLCalendar formatmonth()用法及代码示例
- Python HTMLCalendar formatyearpage()用法及代码示例
- Python calendar HTMLCalendar formatyear()用法及代码示例
- Python HTMLCalendar formatyear()用法及代码示例
- Python HTMLCalendar formatmonth()用法及代码示例
- Python HTML转Markdown用法及代码示例
- Python calendar HTMLCalendar formatyearpage()用法及代码示例
- Python cudf.core.column.string.StringMethods.is_vowel用法及代码示例
- Python torch.distributed.rpc.rpc_async用法及代码示例
- Python torch.nn.InstanceNorm3d用法及代码示例
- Python sklearn.cluster.MiniBatchKMeans用法及代码示例
- Python pandas.arrays.IntervalArray.is_empty用法及代码示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代码示例
- Python numpy.less()用法及代码示例
- Python Matplotlib.figure.Figure.add_gridspec()用法及代码示例
- Python tf.compat.v1.distribute.MirroredStrategy.experimental_distribute_dataset用法及代码示例
- Python Django File.save用法及代码示例
- Python Sympy Permutation.list()用法及代码示例
注:本文由纯净天空筛选整理自djangoproject.com大神的英文原创作品 django.http.HttpRequest.user。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
