コード例 #1
0
ファイル: urls.py プロジェクト: caizhimin/sttri_hr
def my_leaves(request):
    """
    每人的请假记录页面
    :param request:
    :return:
    """
    if request.GET.get('code') or request.session.get('user_id', ''):
        user_id = request.session.get('user_id', '')
        if not user_id:
            user_id = get_user_id(request.GET.get('code'))
        request.session['user_id'] = user_id
        if not WXUser.objects.filter(wx_openid=user_id).exists():
            return HttpResponseRedirect('/binding')
        else:
            leaves = Leave.objects.filter(
                applicant_openid=user_id).order_by('-create_time')

            now = datetime.datetime.now()
            expired_out_leaves = Leave.objects.filter(
                applicant_openid=user_id,
                status=3,
                leave_end_datetime__lte=now,
                group=2)
            expired_out_leaves.update(status=4)  # 超过当前日期的外出(已通过)变为完成
        return render_to_response('my_leaves.html', {'leaves': leaves},
                                  context_instance=RequestContext(request))
    return HttpResponseRedirect(
        get_code_url('http://wachat.sttri.com.cn/my_leaves'))
コード例 #2
0
ファイル: urls.py プロジェクト: caizhimin/sttri_hr
def out(request):
    """
    外出页面
    :param request:
    :return:
    """
    if request.GET.get('code') or request.session.get('user_id', ''):
        user_id = request.session.get('user_id', '')
        if not user_id:
            user_id = get_user_id(request.GET.get('code'))
        request.session['user_id'] = user_id
        if not WXUser.objects.filter(wx_openid=user_id).exists():
            return HttpResponseRedirect('/binding')
        else:
            current_user = WXUser.objects.get(wx_openid=user_id)
        return render_to_response('out.html', {'current_user': current_user},
                                  context_instance=RequestContext(request))
    return HttpResponseRedirect(get_code_url('http://wachat.sttri.com.cn/out'))
コード例 #3
0
ファイル: urls.py プロジェクト: caizhimin/sttri_hr
def out(request):
    """
    外出页面
    :param request:
    :return:
    """
    if request.GET.get('code') or request.session.get('user_id', ''):
        user_id = request.session.get('user_id', '')
        if not user_id:
            user_id = get_user_id(request.GET.get('code'))
        request.session['user_id'] = user_id
        if not WXUser.objects.filter(wx_openid=user_id).exists():
            return HttpResponseRedirect('/binding')
        else:
            current_user = WXUser.objects.get(wx_openid=user_id)
        return render_to_response('out.html', {'current_user': current_user},
                                  context_instance=RequestContext(request))
    return HttpResponseRedirect(get_code_url('http://wachat.sttri.com.cn/out'))
コード例 #4
0
ファイル: urls.py プロジェクト: caizhimin/sttri_hr
def approved_record(request):
    """
    审批记录页面
    :param request:
    :return:
    """
    if request.GET.get('code') or request.session.get('user_id', ''):
        user_id = request.session.get('user_id', '')
        if not user_id:
            user_id = get_user_id(request.GET.get('code'))
        request.session['user_id'] = user_id
        if not WXUser.objects.filter(wx_openid=user_id).exists():
            return HttpResponseRedirect('/binding')
        else:
            current_user = WXUser.objects.get(wx_openid=user_id)
            # 审批过的中的请假/外出记录
            approved_leaves = Leave.objects.filter(all_dealers__contains=user_id).order_by('-create_time')
        return render_to_response('approve_record.html', {'approved_leaves': approved_leaves},
                                  context_instance=RequestContext(request))
    return HttpResponseRedirect(get_code_url('http://wachat.sttri.com.cn/approve'))
コード例 #5
0
ファイル: urls.py プロジェクト: caizhimin/sttri_hr
def approved_record(request):
    """
    审批记录页面
    :param request:
    :return:
    """
    if request.GET.get('code') or request.session.get('user_id', ''):
        user_id = request.session.get('user_id', '')
        if not user_id:
            user_id = get_user_id(request.GET.get('code'))
        request.session['user_id'] = user_id
        if not WXUser.objects.filter(wx_openid=user_id).exists():
            return HttpResponseRedirect('/binding')
        else:
            current_user = WXUser.objects.get(wx_openid=user_id)
            # 审批过的中的请假/外出记录
            approved_leaves = Leave.objects.filter(
                all_dealers__contains=user_id).order_by('-create_time')
        return render_to_response('approve_record.html',
                                  {'approved_leaves': approved_leaves},
                                  context_instance=RequestContext(request))
    return HttpResponseRedirect(
        get_code_url('http://wachat.sttri.com.cn/approve'))
コード例 #6
0
ファイル: urls.py プロジェクト: caizhimin/sttri_hr
def my_leaves(request):
    """
    每人的请假记录页面
    :param request:
    :return:
    """
    if request.GET.get('code') or request.session.get('user_id', ''):
        user_id = request.session.get('user_id', '')
        if not user_id:
            user_id = get_user_id(request.GET.get('code'))
        request.session['user_id'] = user_id
        if not WXUser.objects.filter(wx_openid=user_id).exists():
            return HttpResponseRedirect('/binding')
        else:
            leaves = Leave.objects.filter(applicant_openid=user_id).order_by('-create_time')

            now = datetime.datetime.now()
            expired_out_leaves = Leave.objects.filter(applicant_openid=user_id, status=3,
                                                      leave_end_datetime__lte=now, group=2)
            expired_out_leaves.update(status=4)  # 超过当前日期的外出(已通过)变为完成
        return render_to_response('my_leaves.html', {'leaves': leaves},
                                  context_instance=RequestContext(request))
    return HttpResponseRedirect(get_code_url('http://wachat.sttri.com.cn/my_leaves'))