示例#1
0
文件: views.py 项目: renatofb/weblate
def users_check(request):
    form = UserSearchForm(request.GET if request.GET else None)

    user_list = None
    if form.is_valid():
        email = form.cleaned_data["email"]
        user_list = User.objects.filter(
            Q(email=email)
            | Q(social_auth__verifiedemail__email__iexact=email)
            | Q(username=email)).distinct()
        if user_list.count() != 1:
            return redirect_param(
                "manage-users",
                "?q={}".format(quote(form.cleaned_data["email"])))
        return redirect(user_list[0])
    return redirect("manage-users")
示例#2
0
def users_check(request):
    form = UserSearchForm(request.GET if request.GET else None)

    user_list = None
    if form.is_valid():
        email = form.cleaned_data["email"]
        user_list = User.objects.filter(
            Q(email=email)
            | Q(social_auth__verifiedemail__email__iexact=email)).distinct()

    return render(
        request,
        "manage/users_check.html",
        {
            "menu_items": MENU,
            "menu_page": "users",
            "form": form,
            "users": user_list,
        },
    )