Пример #1
0
def deleteSchedule(request, cell_name, pk):
    try:
        elem = busyHourDaily.objects.get(pk=pk)
        elem.delete()
    except:
        print "Element not found"
    cell_obj = CellInfo.objects.get(cell_name=cell_name)
    reArrangeSched(0,cell_obj)
    template = loader.get_template('blueEye/showSchedule.html')
    busyHourList = busyHourDaily.objects.filter(busyHour=cell_name)
    cht = schedule_chart(request,cell_name)
    context = RequestContext(request, 
              {'busyHourList':busyHourList,
               'cell_name':cell_name,
               'sched_chart':cht})
    return HttpResponse(template.render(context))
Пример #2
0
def showSchedule(request):
    busyHourList = {}
    print "showSchedule Called"
    template = loader.get_template('blueEye/showSchedule.html')
    cell_name = ""
    if request.method == 'POST':
        cell_name = request.POST.get("CellName", "")
        busyHourList = busyHourDaily.objects.filter(busyHour=cell_name)
        if len(busyHourList) == 0:
            try:
                cell_obj = CellInfo.objects.get(cell_name=cell_name)
                reArrangeSched(0, cell_obj)
            except:
                cell_obj=""
    sched_chart = schedule_chart(request,cell_name)
    print sched_chart.datasource
    context = RequestContext(request, 
              {'busyHourList':busyHourList,
               'cell_name':cell_name,
               'sched_chart': sched_chart})
    return HttpResponse(template.render(context))
Пример #3
0
def saveSchedule(request):
    cell_name =""
    startHour =""
    endHour =""
    pd = 0
    busyHourList = {}
    if request.method == 'POST':
        cell_name = request.POST.get("CellName", "")
        startHour = request.POST.get("StartHour", "")
        endHour = request.POST.get("EndHour", "")
        pd = request.POST.get("popDen", "")
        id = request.POST.get("identity", "")
        print cell_name, startHour, endHour, pd, id
        if id == '9999':
            elem = busyHourDaily()
        else:
            elem = busyHourDaily.objects.get(pk=id)
        print startHour, endHour
        if not int(startHour) >= int(endHour):
            print "Here"
            elem.startHour = startHour
            elem.endHour = endHour 
            elem.density = int(pd)
            print pd
            cell_obj = CellInfo.objects.get(cell_name=cell_name)
            elem.busyHour = cell_obj
            elem.save()
            logging.debug("Saving New Element pd %d", int(pd))
            reArrangeSched(elem, cell_obj)
    cht = schedule_chart(request,cell_name)
    template = loader.get_template('blueEye/showSchedule.html')
    busyHourList = busyHourDaily.objects.filter(busyHour=cell_name)
    context = RequestContext(request, 
              {'busyHourList':busyHourList,
               'cell_name':cell_name,
               'sched_chart':cht})
    return HttpResponse(template.render(context))