Пример #1
0
def submit_form(request, risk_id=None):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    risk = None
    user = request.user
    if risk_id:
        try:
            risk = RiskManagement.objects.get(id=risk_id)
        except ObjectDoesNotExist:
            risk = None

    if request.method == "POST":
        form = RiskManagementForm(risk, request.POST)
        print request.POST
        # if form.is_valid():
        # data = form.cleaned_data

        form.handle(request.POST, user, risk)
        return HttpResponseRedirect("/riskmanagement/")
    else:
        form = RiskManagementForm(risk)
    context = RequestContext(
        request, {"form": form, "leadflag": leadflag, "managerflag": managerflag, "username": user}
    )
    return render_to_response("riskmanagement/riskinsertform.html", context_instance=context)
Пример #2
0
def submit_form(request, risk_id=None):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    risk = None
    user = request.user
    if risk_id:
        try:
            risk = RiskManagement.objects.get(id=risk_id)
        except ObjectDoesNotExist:
            risk = None

    if request.method == 'POST':
        form = RiskManagementForm(risk, request.POST)
        print request.POST
        #if form.is_valid():
        #data = form.cleaned_data

        form.handle(request.POST, user, risk)
        return HttpResponseRedirect('/riskmanagement/')
    else:
        form = RiskManagementForm(risk)
    context = RequestContext(
        request, {
            'form': form,
            'leadflag': leadflag,
            'managerflag': managerflag,
            'username': user
        })
    return render_to_response("riskmanagement/riskinsertform.html",
                              context_instance=context)
Пример #3
0
def release_phase_form(request, phase_id=None):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    phase = None
    user = request.user
    if phase_id:
        try:
            phase = ReleasePhase.objects.get(id=phase_id)
        except ObjectDoesNotExist:
            pass
    if request.method == 'POST':
        form = ReleasePhaseForm(phase, request.POST)

        if form.is_valid():
            data = form.cleaned_data
            f = form.handle(data, phase)
            return HttpResponseRedirect('/release/phase/')
        else:
            error_msg = 'Release Phase Name is required'
            context = RequestContext(request, {'form': form,
                                       'leadflag': leadflag,
                                       'managerflag': managerflag,
                                       'error_msg':error_msg,
                                       'username': user})
            return render_to_response("releasedata/phase/releasephaseinsertform.html",
                              context_instance=context)

    else:
        form = ReleasePhaseForm(phase)
    context = RequestContext(request, {'form': form,
                                       'leadflag': leadflag,
                                       'managerflag': managerflag,
                                       'username': user})
    return render_to_response("releasedata/phase/releasephaseinsertform.html",
                              context_instance=context)
Пример #4
0
def submit_form(request):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    teamObj = None
    user = request.user
    team_id = request.GET.get('team_id', None)
    if team_id:
        try:
            teamObj = Teams.objects.get(id=team_id)
        except ObjectDoesNotExist:
            pass
    if request.method == 'POST':
        form = TeamForm(teamObj, request.POST)

        if form.is_valid():
            data = form.cleaned_data
            form.handle(data, teamObj)
            context = RequestContext(request, {})
            return HttpResponseRedirect('/team/')

    else:
        form = TeamForm(teamObj)
    context = RequestContext(request, {'form': form,
                                       'leadflag': leadflag,
                                       'managerflag': managerflag,
                                       'username': user})
    return render_to_response("users/team/teaminsert.html",
                              context_instance=context)
Пример #5
0
def index(request):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    riskObjList = RiskManagement.objects.all()
    context = RequestContext(
        request,
        {"username": request.user, "leadflag": leadflag, "managerflag": managerflag, "riskObjList": riskObjList},
    )
    return render_to_response("riskmanagement/risk_management_index.html", context_instance=context)
Пример #6
0
def index(request):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    releaseslist = Release.objects.all()
    context = RequestContext(request,
                             {'username': request.user,
                              'leadflag': leadflag,
                              'managerflag': managerflag,
                              'releases': releaseslist})

    return render_to_response("releasedata/release_index.html",
                              context_instance=context)
Пример #7
0
def index(request):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    riskObjList = RiskManagement.objects.all()
    context = RequestContext(
        request, {
            'username': request.user,
            'leadflag': leadflag,
            'managerflag': managerflag,
            'riskObjList': riskObjList
        })
    return render_to_response("riskmanagement/risk_management_index.html",
                              context_instance=context)
Пример #8
0
def phase_index(request):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    releaseslist = ReleasePhase.objects.all()
    context = RequestContext(
        request, {
            'username': request.user,
            'leadflag': leadflag,
            'managerflag': managerflag,
            'releases': releaseslist
        })

    return render_to_response("releasedata/phase/phase_index.html",
                              context_instance=context)
Пример #9
0
def index(request):
    '''presently index page just render static page and returns it back'''
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    target_list = Target.objects.filter(emp=request.user)
#    target_dict = {}
#    for target in target_list:
#        target_dict.default(target.release.relname, {})
#        target_dict[target.release.relname]\
#            .default(target.release_phase.release_phase, [])

    return render_to_response("index.html",
                        {'username': request.user,
                        'target_list':target_list,
                        'leadflag': leadflag,
                        'managerflag': managerflag, })
Пример #10
0
def release_form(request, release_id=None):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    release = None
    error_msg = None
    user = request.user
    if release_id:
        try:
            release = Release.objects.get(id=release_id)
        except ObjectDoesNotExist:
            release = None

    if request.method == 'POST':

        form = ReleaseForm(release, request.POST)
        if form.is_valid():
            data = form.cleaned_data
            form = form.handle(data, release)
            return HttpResponseRedirect('/release/')
        else:
            error_msg = 'Release Name is required'
            context = RequestContext(
                request, {
                    'form': form,
                    'leadflag': leadflag,
                    'managerflag': managerflag,
                    'error_msg': error_msg,
                    'username': user
                })
            return render_to_response("releasedata/releaseinsertform.html",
                                      context_instance=context)

    else:
        form = ReleaseForm(release)
    context = RequestContext(
        request, {
            'form': form,
            'leadflag': leadflag,
            'managerflag': managerflag,
            'username': user
        })
    return render_to_response("releasedata/releaseinsertform.html",
                              context_instance=context)
Пример #11
0
def profile(request):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    employee = None
    user = request.user
    try:
        employee = Employees.objects.get(user=request.user)
        if employee.birthdate:
            birthdate = employee.birthdate.strftime('%Y-%m-%d')
        else:
            birthdate = datetime.now().strftime('%Y-%m-%d')
        if employee.hiredate:
            hiredate = employee.hiredate.strftime('%Y-%m-%d')
        else:
            hiredate = datetime.now().strftime('%Y-%m-%d')
    except ObjectDoesNotExist:
        birthdate = datetime.now().strftime('%Y-%m-%d')
        hiredate = datetime.now().strftime('%Y-%m-%d')

    if request.method == 'POST':
        form = EmployeeForm(employee, request.POST)
        data = request.POST
        flag = form.handle(data, request.user, employee)
        if flag:
            return HttpResponseRedirect('/')

    else:
        form = EmployeeForm(employee)
    print form
    context = RequestContext(
        request, {
            'form': form,
            'leadflag': leadflag,
            'managerflag': managerflag,
            'username': user,
            'birthdate': birthdate,
            'hiredate': hiredate
        })
    return render_to_response("users/profile.html", context_instance=context)
Пример #12
0
def profile(request):
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    employee = None
    user = request.user
    try:
        employee = Employees.objects.get(user=request.user)
        if employee.birthdate:
            birthdate = employee.birthdate.strftime('%Y-%m-%d')
        else:
            birthdate = datetime.now().strftime('%Y-%m-%d')
        if employee.hiredate:
            hiredate = employee.hiredate.strftime('%Y-%m-%d')
        else:
            hiredate = datetime.now().strftime('%Y-%m-%d')
    except ObjectDoesNotExist:
        birthdate = datetime.now().strftime('%Y-%m-%d')
        hiredate = datetime.now().strftime('%Y-%m-%d')

    if request.method == 'POST':
        form = EmployeeForm(employee, request.POST)
        data = request.POST
        flag = form.handle(data, request.user, employee)
        if flag:
            return HttpResponseRedirect('/')

    else:
        form = EmployeeForm(employee)
    print form
    context = RequestContext(request, {'form': form,
                                       'leadflag': leadflag,
                                       'managerflag': managerflag,
                                       'username': user,
                                       'birthdate':birthdate,
                                       'hiredate':hiredate
                                       })
    return render_to_response("users/profile.html",
                              context_instance=context)
Пример #13
0
def index(request):
    '''presently index page just render static page and returns it back'''
    leadflag = predicate_lead(request.user)
    managerflag = predicate_manager(request.user)
    teams = Teams.objects.all().order_by('-id')
    if request.GET.get('name', False):
        teams = teams.filter(teamname__icontains=request.GET['name'])
    offset = int(request.GET.get("offset", 0))
    nsubs = teams.count()
    teams = teams[offset:offset + 10]
    pages = [urllib.urlencode(dict(name=request.GET.get('name', ''),
                                   offset=i)) for i in range(0, nsubs, 10)]
    template = loader.get_template('users/team/team_index.html')

    context = RequestContext(request,
                             {'username': request.user,
                              'leadflag': leadflag,
                              'managerflag': managerflag,
                              'teams': teams,
                              'pages': pages,
                              'offset': (offset + 10) / 10,
                              'curr_name': request.GET.get('name', '')})
    return HttpResponse(template.render(context))