Example #1
0
def notify_interviewer(model_admin, request, queryset):
    candidate = ''
    interviewer = ''
    for obj in queryset:
        candidate = obj.username + ';' + candidate
        interviewer = obj.first_interviewer_user.username + ';' + interviewer
    dingtalk.send(f"候选人 {candidate} 进入面试环节 面试官 {interviewer}", ['18140047023'])
Example #2
0
def notify_interviewer(modeladmin, request, queryset):
    candidates = ''
    interviewer = ''
    for obj in queryset:
        candidates = obj.username + ";" + candidates
        interviewer = obj.first_interviewer_user.username + ";" + interviewer
    send("候选人  %s   进入面试环节,亲爱的面试官,请准备面试:%s" % (candidates, interviewer))
Example #3
0
def post_delete_callback(sender, instance=None, using=None, **kwarg):
    dict_obj = model_to_dict(instance,
                             exclude=("picture", "attachment", "created_date",
                                      "modified_date"))
    message = "Instance of %s has been deleted: %s" % (
        type(instance), json.dumps(dict_obj, ensure_ascii=False))
    logger.info(message)
    send(message)
Example #4
0
def post_save_callback(sender, instance=None, created=False, **kwarg):
    message = ""
    if isinstance(instance, Job):
        message = "Job for %s has been saved" % instance.job_name
    else:
        message = "Resume for %s %s has been saved " % (
            instance.username, instance.apply_position)

    logger.info(message)
    send(message)
Example #5
0
    def process_exception(self, request, exception):
        if exception:
            message = "url:{url} ** msg:{error}'''''{tb}''''".format(
                url=request.build_absolute_uri(),
                error=repr(exception),
                tb=traceback.format_exc())
            logger.warning(message)
            dingtalk.send(message)
            capture_exception(exception)

        return HttpResponse("Error processiog the request")
Example #6
0
def enter_interview_process(modeladmin, request, queryset):
    candidate_names = ''
    for resume in queryset:
        candidate = Candidate()
        #把obj对象中的所有属性拷贝到candidate对象中
        candidate.__dict__.update(resume.__dict__)
        candidate.created_date = datetime.now()
        candidate.modified_date = datetime.now()
        candidate_names = candidate.username + "," + candidate_names
        candidate.creator = request.user.username
        candidate.save()
    messages.add_message(request, messages.INFO,
                         '候选人%s已经成功进入面试流程' % (candidate_names))
    send("候选人 %s进入面试环节,亲爱的面试官,请准备面试" % (candidate_names))
Example #7
0
def notify_interviewer(model_admin, request, queryset):
    """
    动作菜单,通知对应面试官
    """
    candidates = '、'.join([getattr(rec, 'username', '') for rec in queryset])
    interviewers = '、'.join(
        list(
            set([
                getattr(rec, 'first_interviewer_user', None)
                and getattr(rec, 'first_interviewer_user').username or ''
                for rec in queryset
            ])))
    send("候选人 %s 进入面试环节,亲爱的面试官,请准备好面试: %s" % (candidates, interviewers))
    messages.add_message(request, messages.INFO, '已经成功发送面试通知')
Example #8
0
    def process_exception(self, request, exception):
        if exception:
            message = "url:{url} ** msg:{error} ````{tb}````".format(
                url=request.build_absolute_uri(),
                error=repr(exception),
                tb=traceback.format_exc())

            logger.warning(message)

            # send dingtalk message
            dingtalk.send(message)

            # capture exception to sentry:
            capture_exception(exception)

        return HttpResponse(
            "Error processing the request, please contact the system administrator.",
            status=500)