index_views.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Plamber 作者: OlegKlimenko 项目源码 文件源码
def is_mail_exists(request):
    """
    Checks if mail is exists. If exists return True, else False.
    """
    if request.is_ajax():
        is_mail_exists_form = IsMailExistsForm(request.GET)

        if is_mail_exists_form.is_valid():
            try:
                User.objects.get(email=is_mail_exists_form.cleaned_data['email'])
                return HttpResponse(json.dumps(True), content_type='application/json')

            except ObjectDoesNotExist:
                return HttpResponse(json.dumps(False), content_type='application/json')
    else:
        return HttpResponse(status=404)


# ----------------------------------------------------------------------------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号