当前位置: 首页>>代码示例>>Python>>正文


Python DekiUserBackend.get_deki_user方法代码示例

本文整理汇总了Python中dekicompat.backends.DekiUserBackend.get_deki_user方法的典型用法代码示例。如果您正苦于以下问题:Python DekiUserBackend.get_deki_user方法的具体用法?Python DekiUserBackend.get_deki_user怎么用?Python DekiUserBackend.get_deki_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dekicompat.backends.DekiUserBackend的用法示例。


在下文中一共展示了DekiUserBackend.get_deki_user方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: clean_username

# 需要导入模块: from dekicompat.backends import DekiUserBackend [as 别名]
# 或者: from dekicompat.backends.DekiUserBackend import get_deki_user [as 别名]
 def clean_username(self):
     username = self.cleaned_data.get('username')
     # check deki for existing user (it needs = in front of name)
     deki_user = DekiUserBackend.get_deki_user('='+username)
     if deki_user is not None:
         raise forms.ValidationError(_('The username you entered already exists.'))
     return username
开发者ID:pmclanahan,项目名称:kuma,代码行数:9,代码来源:forms.py

示例2: profile_detail

# 需要导入模块: from dekicompat.backends import DekiUserBackend [as 别名]
# 或者: from dekicompat.backends.DekiUserBackend import get_deki_user [as 别名]
def profile_detail(request, username):
    user = get_object_or_404(User, username=username)
    profile = UserProfile.objects.get(user=user)

    try:
        # HACK: This seems like a dirty violation of the DekiWiki auth package
        from dekicompat.backends import DekiUserBackend
        backend = DekiUserBackend()
        deki_user = backend.get_deki_user(profile.deki_user_id)
    except:
        deki_user = None

    sort_order = request.GET.get('sort', 'created')
    queryset = Submission.objects.all_sorted(sort_order)\
            .exclude(hidden=True)\
            .filter(creator=user)
    return object_list(request, queryset,
        extra_context=dict( 
            profile_user=user, 
            profile_deki_user=deki_user
        ),
        paginate_by=25, allow_empty=True,
        template_loader=template_loader,
        template_object_name='submission',
        template_name='demos/profile_detail.html') 
开发者ID:lmorchard,项目名称:mdn,代码行数:27,代码来源:views.py

示例3: clean_username

# 需要导入模块: from dekicompat.backends import DekiUserBackend [as 别名]
# 或者: from dekicompat.backends.DekiUserBackend import get_deki_user [as 别名]
 def clean_username(self):
     username = self.cleaned_data.get("username")
     if settings.DEKIWIKI_ENDPOINT:
         # Check deki for existing user (it needs = in front of name), but
         # only if the API is available.
         deki_user = DekiUserBackend.get_deki_user("=" + username)
         if deki_user is not None:
             raise forms.ValidationError(_("The username you entered" " already exists."))
     return username
开发者ID:spratt,项目名称:kuma,代码行数:11,代码来源:forms.py


注:本文中的dekicompat.backends.DekiUserBackend.get_deki_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。