本文整理汇总了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
示例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')
示例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