Esempio 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,
            }
        })
Esempio 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
Esempio 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
Esempio 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,
            }
        })
Esempio 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',
     })
Esempio 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',
     })
Esempio 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',
        })
Esempio 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': '保存成功',
        })
Esempio 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,
         }
     })
Esempio 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,
         }
     })
Esempio 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': '保存成功',
        })
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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