Exemplo n.º 1
0
    def post(self, request):
        city_list = request.POST.getlist('city[]', [])
        resume = self.get_user_resume()

        city = [get_object_or_none(City, id=get_int(c)) for c in city_list]
        if not city or None in city:
            return JsonResponse({
                'status': 'form_error',
                'msg': '请选择正确的城市',
                'data': {
                    'city': city_list,
                }
            })

        with transaction.atomic():
            ResumeTargetCity.objects.filter(
                resume=resume
            ).delete()
            for c in city:
                target_city = ResumeTargetCity(
                    resume=resume,
                    city=c,
                )
                target_city.save()
        return JsonResponse({
            'status': 'ok',
            'msg': 'ok',
            'data': {
                'city': city_list,
            }
        })
Exemplo n.º 2
0
    def company_card_interest(cls, job, job_id, interest_type):
        job_id = get_int(job_id)

        if not job_id:
            return False

        company_card_job = get_object_or_none(
            CompanyCardJob,
            job=job,
            id=job_id,
            status='waiting',
        )

        if not company_card_job:
            return False

        now = datetime.datetime.now()
        if interest_type == 1:
            company_card_job.status = 'accept'
        else:
            company_card_job.status = 'reject'

        company_card_job.action_time = now
        company_card_job.save()
        return company_card_job
Exemplo n.º 3
0
    def download_send_resume(cls, job_id, hr_user):
        job_id = get_int(job_id)
        if not job_id:
            return False

        recommend_job_query = RecommendJob.objects.filter(
            id=job_id,
            hr_user=hr_user,
            action='send',
        )
        if not recommend_job_query:
            return False

        now = datetime.datetime.now()
        recommend_job = recommend_job_query[0]
        with transaction.atomic():
            recommend_job.company_action = 'download'
            recommend_job.company_action_time = now
            job_card = recommend_job.job
            hr_user = recommend_job.hr_user
            user = recommend_job.user
            recommend_job.save()
            ChatUtils.add_chat(job_card, hr_user, user, chat_type='feed')
            NotifyUtils.company_notify(recommend_job, 'interview')

        return True
Exemplo n.º 4
0
    def post(self, request):
        city_list = request.POST.getlist('city[]', [])
        resume = self.get_user_resume()

        city = [get_object_or_none(City, id=get_int(c)) for c in city_list]
        if not city or None in city:
            return JsonResponse({
                'status': 'form_error',
                'msg': '请选择正确的城市',
                'data': {
                    'city': city_list,
                }
            })

        with transaction.atomic():
            ResumeTargetCity.objects.filter(resume=resume).delete()
            for c in city:
                target_city = ResumeTargetCity(
                    resume=resume,
                    city=c,
                )
                target_city.save()
        return JsonResponse({
            'status': 'ok',
            'msg': 'ok',
            'data': {
                'city': city_list,
            }
        })
Exemplo n.º 5
0
 def get(self, request, notify_id=None):
     user = request.user
     bat_id = request.GET.getlist('bat_id', [])
     bat_id = [i for i in [get_int(i) for i in bat_id] if i]
     if notify_id:
         query = {'id': notify_id}
     if bat_id:
         query = {'id__in': bat_id}
     else:
         query = {}
     user.notifications.filter(**query).mark_all_as_read()
     return JsonResponse({
         'status': 'ok',
         'msg': 'ok',
     })
Exemplo n.º 6
0
 def get(self, request, notify_id=None):
     user = request.user
     bat_id = request.GET.getlist('bat_id', [])
     bat_id = [i for i in [get_int(i) for i in bat_id] if i]
     if notify_id:
         query = {'id': notify_id}
     if bat_id:
         query = {'id__in': bat_id}
     else:
         query = {}
     user.notifications.filter(**query).mark_all_as_read()
     return JsonResponse({
         'status': 'ok',
         'msg': 'ok',
     })
Exemplo n.º 7
0
    def post(self, request):
        job_id_list = request.POST.getlist('job_id_list[]', [])
        job_id_list = [i for i in [get_int(i) for i in job_id_list] if i]

        if job_id_list:
            user = request.user
            read_count = RecommendJob.objects.filter(
                id__in=job_id_list,
                user=user,
                read_status='unread',
            ).update(
                read_status='read'
            )
            self.add_reco_times(default_times=read_count)
        return JsonResponse({
            'status': 'ok',
            'msg': 'ok',
        })
Exemplo n.º 8
0
    def post(self, request):
        salary_lowest_str = request.POST.get('salary_lowest', '0')
        salary_lowest = get_int(salary_lowest_str)
        if salary_lowest > self.SALARY_MAX or salary_lowest < self.SALARY_MIN:
            return JsonResponse({
                'status': 'form_error',
                'msg': '最低薪资范围必须在%s-%s之间' % (self.SALARY_MIN, self.SALARY_MAX),
                'data': {
                    'salary_lowest': salary_lowest
                }
            })

        resume = self.get_user_resume()
        resume.salary_lowest = salary_lowest
        resume.save()
        return JsonResponse({
            'status': 'ok',
            'msg': '保存成功',
        })
Exemplo n.º 9
0
 def post(self, request):
     work_years = get_int(request.POST.get('work_years'))
     if work_years not in self.work_year_meta:
         return JsonResponse({
             'status': 'form_error',
             'msg': '请选择正确的工作年限',
             'data': {
                 'work_years': work_years,
             }
         })
     resume = self.get_user_resume()
     resume.work_years = work_years
     resume.save()
     return JsonResponse({
         'status': 'ok',
         'msg': 'ok',
         'data': {
             'work_years': work_years,
         }
     })
Exemplo n.º 10
0
 def post(self, request):
     work_years = get_int(request.POST.get('work_years'))
     if work_years not in self.work_year_meta:
         return JsonResponse({
             'status': 'form_error',
             'msg': '请选择正确的工作年限',
             'data': {
                 'work_years': work_years,
             }
         })
     resume = self.get_user_resume()
     resume.work_years = work_years
     resume.save()
     return JsonResponse({
         'status': 'ok',
         'msg': 'ok',
         'data': {
             'work_years': work_years,
         }
     })
Exemplo n.º 11
0
    def post(self, request):
        salary_lowest_str = request.POST.get('salary_lowest', '0')
        salary_lowest = get_int(salary_lowest_str)
        if salary_lowest > self.SALARY_MAX or salary_lowest < self.SALARY_MIN:
            return JsonResponse({
                'status':
                'form_error',
                'msg':
                '最低薪资范围必须在%s-%s之间' % (self.SALARY_MIN, self.SALARY_MAX),
                'data': {
                    'salary_lowest': salary_lowest
                }
            })

        resume = self.get_user_resume()
        resume.salary_lowest = salary_lowest
        resume.save()
        return JsonResponse({
            'status': 'ok',
            'msg': '保存成功',
        })
Exemplo n.º 12
0
 def get_update_obj(self, resume):
     update_id = self.request.POST.get('update_id', '0')
     update_obj = resume.works.filter(
         id=get_int(update_id)
     )
     return update_obj
Exemplo n.º 13
0
 def get_update_obj(self, resume):
     update_id = get_int(self.request.POST.get('update_id', '0'))
     obj = resume.educations.filter(
         id=update_id
     )
     return obj
Exemplo n.º 14
0
 def get_update_obj(self, resume):
     update_id = get_int(self.request.POST.get('update_id', '0'))
     obj = resume.professional_skills.filter(id=update_id)
     return obj
Exemplo n.º 15
0
 def get_update_obj(self, resume):
     update_id = get_int(self.request.POST.get('update_id', '0'))
     obj = resume.educations.filter(id=update_id)
     return obj
Exemplo n.º 16
0
 def get_update_obj(self, resume):
     update_id = self.request.POST.get('update_id', '0')
     update_obj = resume.works.filter(id=get_int(update_id))
     return update_obj
Exemplo n.º 17
0
 def get_update_obj(self, resume):
     update_id = get_int(self.request.POST.get('update_id', '0'))
     obj = resume.professional_skills.filter(
         id=update_id
     )
     return obj