def post(self, request): email = request.POST.get('email', '') if error_email(email): return JsonResponse({ 'status': 'form_error', 'msg': '邮件格式错误', }) feed_id_list = request.POST.get('feed_id_list', '').split(',') if not feed_id_list: return JsonResponse({ 'status': 'form_error', 'msg': '请选择要发送的职位', }) contact_id = get_int(self.request.POST.get('contact_id', '')) candidate = self.get_candidate(contact_id) self.send_email(email, feed_id_list, candidate) candidate.has_contact = True candidate.save() return JsonResponse({ 'status': 'ok', 'msg': '发送成功', })
def clean_email(self): ''' 判断简历重复需要从上传简历和简历库判断 新录入简历判断重复,直接从pinbot简历库ContactInfoData里判断是否存在, 即没有录入简历UploadResume并且ContactInfoData不存在才能通过 编辑简历判断重复,如果用户编辑的简历联系信息是自己上传的简历UploadResume即可以录入 如果用户编辑的简历联系信息不存在,并且不在聘宝简历库中,与新简历信息录入判断逻辑一 致 ''' email = self.cleaned_data['email'].lower() if error_email(email): raise forms.ValidationError('邮件格式有误,请重新填写') has_email_resume = UploadResume.objects.filter( email=email).values_list('id', flat=True) has_contact_email = ContactInfoData.objects.filter( email=email).exists() if not has_email_resume and not has_contact_email: return email if self.resume and self.resume.id in has_email_resume: return email raise forms.ValidationError('邮箱已存在,请重新填写')
def clean_email(self): ''' 判断简历重复需要从上传简历和简历库判断 新录入简历判断重复,直接从pinbot简历库ContactInfoData里判断是否存在, 即没有录入简历UploadResume并且ContactInfoData不存在才能通过 编辑简历判断重复,如果用户编辑的简历联系信息是自己上传的简历UploadResume即可以录入 如果用户编辑的简历联系信息不存在,并且不在聘宝简历库中,与新简历信息录入判断逻辑一 致 ''' email = self.cleaned_data['email'].lower() if error_email(email): raise forms.ValidationError('邮件格式有误,请重新填写') has_email_resume = UploadResume.objects.filter( email=email ).values_list('id', flat=True) has_contact_email = ContactInfoData.objects.filter( email=email ).exists() if not has_email_resume and not has_contact_email: return email if self.resume and self.resume.id in has_email_resume: return email raise forms.ValidationError('邮箱已存在,请重新填写')
def clean_email(self): email = self.cleaned_data["email"] if error_email(email): raise forms.ValidationError("邮件格式有误,请重新填写") has_apply = get_object_or_none(InviteCodeApply, email=email) if has_apply: raise forms.ValidationError("一个邮箱只能申请一次") return email
def clean_user_email(self): email = self.cleaned_data['user_email'].lower() if error_email(email): raise forms.ValidationError('邮件格式有误,请重新填写') exist_user = get_object_or_none( User, username=email, ) if exist_user: raise forms.ValidationError('邮箱名已存在') return email
def clean_email(self): email = self.cleaned_data['email'] if error_email(email): raise forms.ValidationError('邮件格式有误,请重新填写') has_apply = get_object_or_none( InviteCodeApply, email=email, ) if has_apply: raise forms.ValidationError('一个邮箱只能申请一次') return email
def clean_user_email(self): email = self.cleaned_data['user_email'].lower() if error_email(email): raise forms.ValidationError('邮件格式有误,请重新填写') exist_user = get_object_or_none( User, username=email, ) if exist_user: raise forms.ValidationError('邮箱名已存在') openid = self.request.session.get('openid', '') has_weixin_user = WeixinService.get_weixin_user(openid=openid) if has_weixin_user: raise forms.ValidationError('微信用户已存在') return email
def get(self, request): email = request.GET.get('email', '') if error_email(email): return JsonResponse({ 'status': 'form_error', 'msg': '请输入正确的邮箱!', }) has_apply = get_object_or_none( InviteCodeApply, email=email, ) if has_apply: return JsonResponse({ 'status': 'has_apply', 'msg': '你的邮箱已经申请过!', }) return JsonResponse({ 'status': 'ok', 'msg': '可以使用', })
def clean_contact_email(self): email = self.cleaned_data['contact_email'].lower().strip() if error_email(email): raise forms.ValidationError(u'邮件格式错误') return email