当前位置: 首页>>代码示例>>Python>>正文


Python views.render_to_response_ex函数代码示例

本文整理汇总了Python中videoclient.views.render_to_response_ex函数的典型用法代码示例。如果您正苦于以下问题:Python render_to_response_ex函数的具体用法?Python render_to_response_ex怎么用?Python render_to_response_ex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了render_to_response_ex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: visitorcard

def visitorcard(request, vcid=None, project = None):
    
    data = dict()    
    data.update(getDefaultParams(request, 'visitors', project))    
    form = TestVisitorCard(request.POST, request.FILES)
    if form.is_valid():
        dt1 = "%s %s:%s:00" % (form.cleaned_data["dateVisit1"], form.cleaned_data["time11"], form.cleaned_data["time12"])
        dt2 = "%s %s:%s:00" % (form.cleaned_data["dateVisit2"], form.cleaned_data["time21"], form.cleaned_data["time22"])
        if form.cleaned_data["visitor"] and form.cleaned_data["person"]:
            if form.cleaned_data["vcid"]:
                VisitingCard.objects.filter(id=form.cleaned_data["vcid"]).update(visitor=PersonId.objects.get(id=form.cleaned_data["visitor"]), person=PersonId.objects.get(id=form.cleaned_data["person"]), ground=Ground.objects.get(id=form.cleaned_data["ground"]), dt_enter=dt1, dt_exit=dt2)
            else: vcid = VisitingCard.objects.create(visitor_id=form.cleaned_data["visitor"], person_id=form.cleaned_data["person"], ground_id=form.cleaned_data["ground"], dt_enter=dt1, dt_exit=dt2)
    else: logging.info(form.errors)
    data.update(getVisitorInfo(request))
    data.update(getGround(request))
    data.update(getDataDivision(request))
    if vcid: data.update(dataVisitors(request, vcid))
    dt = dict()
    data['learn'] = True
    dt["errors"] = form.errors
    dt["post"] = True if request.POST else False    
    data.update(dt)
    if project is not None:
        return render_to_response_ex(request, project + "visitorcard.html", data)
    else:
        return render_to_response_ex(request, "visitorcard.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:26,代码来源:views.py

示例2: photosperson

def photosperson(request, id, project=None):
    
    person = PersonId.objects.get(id = int(id)).person
    p = PersonId.objects.get(id = int(id))
    division = person.status.division.name
    
    if division == "Персоны":
        select_page = 'photosperson'
    elif division == "Посетители":
        select_page = 'photosvisitor'
    elif division == "Сотрудники":
        select_page = 'photosstaff'
    elif division == "Автообученные":
        select_page = 'photosauto'
        
    
    data = getDefaultParams(request, select_page, project)
    data.update(dataPhotoById(id))
    data.update(dataPerson(request, int(person.id), division))
    data['photos_'] = data['allphotos']['photos']
    data['person_id'] = p.id
    if request.COOKIES.has_key("eyes") and request.COOKIES["eyes"] == "true": 
        data["eyes"] = "true"
    
    if project is not None:
        return render_to_response_ex(request, project+"photosperson.html", data, context_instance=RequestContext(request))
    else:
        return render_to_response_ex(request, "photosperson.html", data, context_instance=RequestContext(request))
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:28,代码来源:views.py

示例3: anketavisitor

def anketavisitor(request, id=None, id2 = None, project = None):
    
    data = dict()
    data.update(getDefaultParams(request, 'anketavisitor', project))
    data.update(dataPerson(request, id, 'Посетители', id2, one = 1))
    data['learn'] = True
    if request.POST.has_key(ADDPHOTO) and len(str(data['user']['id_person']))>0 and data['user']['id_person']>0:
        str_redirect = ""
        if project is not None:
            str_redirect = '/'+project+'/addphotoperson/visitors/%s/' %int(data['user']['id_person'])
        else:
            str_redirect = '/addphotoperson/visitors/%s/' %int(data['user']['id_person'])
        if data.has_key('group'):
            str_redirect = str_redirect+"?group="+str(data['group'])            
        return HttpResponseRedirect(str_redirect)
        #return HttpResponseRedirect(getStrRedirect(data, '/addphotoperson/visitors/%s/' %int(data['user']['id_person']), project))
    
    if request.POST.has_key("first_name") and len(str(data['user']['id']))>0 and data['user']['id']>0:#first_nameADDPHOTO
        str_redirect = ""
        if project is not None:
            str_redirect = '/'+project+'/anketavisitor/%s/?save=1' %int(data['user']['id'])
        else:
            str_redirect = '/anketavisitor/%s/?save=1' %int(data['user']['id'])
        if data.has_key('group'):
            str_redirect = str_redirect+"&group="+str(data['group'])            
        if data.has_key('istraining') and data['istraining'] and data.has_key('learned'):
            str_redirect = str_redirect+"&learned="+str(data['learned'])
        return HttpResponseRedirect(str_redirect)
    
    if project is not None:
        return render_to_response_ex(request, project+"anketavisitor.html", data)
    else:
        return render_to_response_ex(request, "anketavisitor.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:33,代码来源:views.py

示例4: journal_videoanalytics

def journal_videoanalytics(request):

    data = dict()
    data = getIdentData(request)
    if space:
        s = commands.getoutput(space)
        s = s.replace("\n", "")
        m = re.match(r".*G *([0-9]+)%.*", s)
        if m and m.group(1):
            data["space"] = 100-int(m.group(1))

    data.update(getDefaultParams(request, 'journal_videoanalytics'))
    #data.update( {"csm": float(get_value_defaultparams(journalBoundCoeff))*100})
    data.update(dataVAJournal(request))
    #raise Exception(data["all_users"])
    data.update(getDataDivision(request))
    data.update(dataNavigation(request, data['all_users']))
    data["users"] = data["users"][data['start']-1:data['finish']-1]
    data.update(dataGet(request))
    
    #if request.GET.has_key('data') and not request.GET.has_key('countrows'):
    #    return render_to_response("datajournal.html", data)
    #elif request.GET.has_key('countrows'):
    #    return JsonResponse({'countrows': data['all_users']})
    #else:
    if request.GET.has_key('data') and not request.GET.has_key('countrows'):
        return render_to_response_ex(request, "data_journal_videoanalitics.html", data)
    return render_to_response_ex(request, "journal_videoanalytics.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:28,代码来源:views.py

示例5: kpp

def kpp(request, project=None):
    
    data = getDefaultParams(request, 'kpp', project)
    data.update(getSearchKpp(request))
    data.update(dataGuards(None, data["users"]))
    sort = [
            ["j_id"],
#            ["user", "kpp", "name"],
            ["kpp"],
#            ["user", "kpp", "name"],
            ["kpp"],            
            ["login"],
            ['logint_time'],
#            ["login"],
            ["logout"],
            ['logout_time'],
#            ["logout"],
#            ["staff", "person", "fio"]]
            ["fio"],
            ["status"]]
    data["users"] = GlobalSortUser(data["users"], sort, data["sorto"], data["up"])     
    data.update(dataNavigation(request, data['all_users']))    
    if project is not None:
        return render_to_response_ex(request, project+"kpp.html", data)
    else:
        return render_to_response_ex(request, "kpp.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:26,代码来源:views.py

示例6: settingspage

def settingspage(request, ident=False):
        
    from videoclient import models
    
    HOST, PORT, LOGIN, PASSWD, USER = initBalancer()
    SERVERC, PORTC, COMMUNICATORS = initCommunicators()
    index = 0
    if request.GET.has_key('index'):
        index = int(request.GET['index'])
    else:
        if 'index' in request.COOKIES:
            index = int(request.COOKIES['index'])        
        
    if index < 0:
        index = 0
    if index >= len(COMMUNICATORS):
        index = len(COMMUNICATORS)-1
        
    error = False
    c = Communicator(COMMUNICATORS[index]['host'], COMMUNICATORS[index]['port'])
    cameras = []
    try:
        cameras = c.getCameras()
        for camera in cameras:
            models.Camera.objects.get_or_create(ip = camera['ip'], type = camera['type'])
            camera['mode'] = int(c.getModeScheduler(camera['numcamera']))
    except:
        error = True
    
    c.close()
    del c
    
    
    
    dis_eye = None
    
    data = {'host': HTTP_HOST, 'select_page': 'settings',
                              'select_subpage': 'cameras', 'user': request.user.username,
                              'communicators': COMMUNICATORS, 'cameras': cameras,
                              'name': '%s:%s' %(COMMUNICATORS[index]['host'], COMMUNICATORS[index]['port']),
                              'error': error, 'index': index, 'modes': [0, 1, 2, -1],
                              'dis_eye': dis_eye,
                              'bal' : {'host':HOST, 'port':PORT, 'login':LOGIN, 'passwd':PASSWD, 'user':USER}
                              }
    
    data.update(getDefaultParams(request, 'settingspage'))
    data.update(dataNavigation(request, len(cameras)))
    
    if ident:
        from videoclient.views import getIdentData
        data.update(getIdentData(request))
        data.update(getDefaultParams(request, 'ident'))
        response =  render_to_response_ex(request, "po4ident.html", data)
    else:
        response =  render_to_response_ex(request, "po4settingspage.html", data)

    response.set_cookie("index", index) 
    
    return response
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:59,代码来源:views.py

示例7: visitors

def visitors(request, project=None):
    
    data = dict()
    data.update(getDefaultParams(request, 'visitors', project))
    data.update(dataVisitors(request))
    data.update(dataNavigation(request, len(data['visitingcard'])))
    if project is not None:    
        return render_to_response_ex(request, project+"visitors.html", data)
    else:
        return render_to_response_ex(request, "visitors.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:10,代码来源:views.py

示例8: staff

def staff(request, project=None):
    
    data = dict()
    data.update(getDefaultParams(request, 'staff', project))
    data.update(dataStaff(request))
    data.update(dataNavigation(request, len(data['staffs'])))
    if project is not None:
        return render_to_response_ex(request, project + "staff.html", data)
    else:
        return render_to_response_ex(request, "staff.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:10,代码来源:views.py

示例9: historychange

def historychange(request, project=None):
    
    data = getDefaultParams(request, 'historychange', project)
    data.update(getSearchHistory(request))    
    data.update(dataGuards(None, data["users"], is_person=True))
    data.update(dataNavigation(request, data['all_users']), is_person=True)
    if project is not None:
        return render_to_response_ex(request, project+"historychange.html", data)
    else:
        return render_to_response_ex(request, "historychange.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:10,代码来源:views.py

示例10: journal

def journal(request):
    
    data = getDefaultParams(request, 'journal')
    data.update(dataJournal(request))
    data.update(getDataDivision(request))
    data.update(dataNavigation(request, data['all_users']))
    data.update(dataGet(request))
    if request.GET.has_key('data'):
        return render_to_response_ex(request, "po4datajournal.html", data)
    else:
        return render_to_response_ex(request, "po4journal.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:11,代码来源:views.py

示例11: anketaauto

def anketaauto(request, id=None, id2 = None, project=None):
    
    data = dict()
    data.update(getDefaultParams(request, 'anketaauto', project))
    data.update(dataPerson(request, id, 'Автообученные', id2, one=1))
    data['learn'] = True
    if request.POST.has_key(ADDPHOTO) and len(str(data['user']['id_person']))>0 and data['user']['id_person']>0:
        return HttpResponseRedirect(getStrRedirect(data, '/addphotoperson/auto/%s/' %int(data['user']['id_person']), project))
    if project is not None:
        return render_to_response_ex(request,project + "anketaauto.html", data)
    else:
        return render_to_response_ex(request,"anketaauto.html", data)    
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:12,代码来源:views.py

示例12: user_list

def user_list(request, uid=None, num=1):
    if num == None: num = 1
    data = dict()
    data = getDefaultParams(request, 'control_settings_users', project)
    data["select_page"] = 'control_settings_users'
    data["user"] = request.user
    data["page"] = "user"
    try:
        HOST, PORT, LOGIN, PASSWORD, USER = initBalancer()
        data["HOST"] = HOST
        data["PORT"] = PORT        
        b = Balancer(HOST, PORT, LOGIN, PASSWORD, USER)
        if uid:
            data["ulogin"] = uid                
            params = b.getLoginParameters(uid)
            data["params"] = params
            data["number"] = config.number
            data["boolean"] = config.boolean
            data["text"] = config.text 
            post = request.POST
            save = False
            if "save" in post: save = True
            i = 0
            for base in params["bases"]:
                base["index"] = "params"
                base["params"] = sorted(base["params"], key=lambda x: x["name"]) 
                for p in base["params"]:
                    p["spin_id"] = i                
                    i += 1
                    p = get_params_value(p, p["name"])
                    s = "%s_%s" % (base["name"], p["name"])
                    p["id"] = s                    
                    if save:                    
                        if s in post:                      
                            if str(post[s] if post[s] != "" else "None") != str(p["val"]):
                                posts = post[s] #if post[s] != "" else False
                                if b.setParameter(value=posts, param=p["name"], toBase=base["name"]): p["val"] = posts
                                else: p["error"] = "ошибка параметра"
            b.close()
            del b
            return render_to_response_ex(request, "control_settings_user.html", data)
        users = b.getLogins()
        data["all_count"] = len(users)
        b.close()
        del b
        data = numerate(data, num=num, all_count=len(users))
        data["users"] = users[data["ind_start"]:data["ind_end"]]
        return render_to_response_ex(request, "control_settings_users.html", data)
    except:
        logging.exception("user_list "+str(sys.exc_info()))
        data["us_error"] = str(sys.exc_info())
        return render_to_response_ex(request, "control_settings_users.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:52,代码来源:views.py

示例13: default_params

def default_params(request):
    data = dict()
    data = getDefaultParams(request, 'control_settings_default', project)
    data["select_page"] = 'control_settings_default'
    data["user"] = request.user    
    data["page"] = "settings"
    data["title"] = _("Настройки по умолчанию")
    data["number"] = config.number
    data["boolean"] = config.boolean
    data["text"] = config.text
    post = request.POST
    base = "default"    
    data["base"] = base    
    data["max_length"] = config.max_text_width
    data["min_length"] = config.min_text_width
    data["val_length"] = config.text_length      
    try:
        HOST, PORT, LOGIN, PASSWORD, USER = initBalancer()
        data["HOST"] = HOST
        data["PORT"] = PORT    
        b = Balancer(HOST, PORT, LOGIN, PASSWORD, USER)
        """
        try:    
            if "add" in post: 
                form = AddParamsForm(post, request.FILES)
                if form.is_valid():
                    if not b.setParameter(value=form.cleaned_data["param_value"], param = form.cleaned_data["param_name"], toBase=base):
                        data["error_add"] = "Ошибка добавления параметра"
                        data["param_name"] = form.cleaned_data["param_name"]
                        data["param_value"] = form.cleaned_data["param_value"]
                else:
                    data["error_add"] = form.errors
        except:
            logging.exception("control_settings add new param "+str(sys.exc_info()))
            data["error_add"] = "Ошибка добавления параметра"    
        """
        params = b.getAllParameters()
        allparam = map(lambda x: x["params"], filter(lambda x: x["name"]==base, params))[0]
        allparam = sorted(allparam, key=lambda x: x["name"])
        #allparam = map(get_fullinfo, allparam)
       
        allparam = map(lambda x: get_fullinfo(x), allparam)
        data["params"] = allparam
        if "update" in post: 
            return render_to_response_ex(request, "control_settings_param.html", data) 
        #data["info"] = {"info": get_plist(request, allparam, "default")}
        b.close()
        del b
    except:
        logging.exception("default_params "+str(sys.exc_info()))
        data["us_error"] = str(sys.exc_info())
    return render_to_response_ex(request, "control_settings_settings.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:52,代码来源:views.py

示例14: learn_camera

def learn_camera(request, select_page, communicator, numcamera, person, project=None):
    
    from videoclient.views import initBalancer, initCommunicators
    from videoclient.communicator import *
    from videoclient.balancer import *
    from videoclient import models
    
    
    HOST, PORT, LOGIN, PASSWD, USER = initBalancer()
    SERVERC, PORTC, COMMUNICATORS = initCommunicators()
    
    server = COMMUNICATORS[int(communicator)]['host']
    port = COMMUNICATORS[int(communicator)]['port']
    
    mode = 0
    
    try:
        c = Communicator(server, int(port))
        mode = c.getModeScheduler(numcamera)
        c.close()
        del c
    except:
        pass
    
    
    user = request.user.username
    
    host = HTTP_HOST
    host2f = host.replace('/', '\%2F')
    
    data = {'user': request.user.username,
                        'communicator': communicator, 'person': person, 'server': server, 'port':port, 
                        'numcamera': numcamera, 'mode': mode,
                        'bal' : {'host':HOST, 'port':PORT, 'login':LOGIN, 'passwd':PASSWD, 'user':USER}}
    
    id = int(person)
    data['person'] = idToName(id)

    data.update(getDefaultParams(request, select_page, project))
    
    data['id'] = id
    data['addperson'] = idToName(id)
    person = PersonId.objects.get(id = int(id)).person
    data['user'] = person.getDict()
    data['learn'] = True
    if project is not None:
        return render_to_response_ex(request, project+"learn_camera2.html", data)
    else:
        return render_to_response_ex(request, "learn_camera2.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:49,代码来源:views.py

示例15: map

def map(request, map_id=None):

    data = dict()
    data = getIdentData(request)
    data.update(getDefaultParams(request, 'maps'))
    
    all_cameras = None
    try:
        all_cameras = Camera.objects.filter().order_by('pk')
    except:
        all_cameras = None
    
    data["all_cameras"] = all_cameras    
    
    map = dict()
    if map_id:
        try:
            map = get_object_or_404(Map, id=int(map_id))
        except:
            pass
    else:
        try:
            map = Map.objects.filter()[0]
        except:
            pass
    data["map"] = map
    data["map_is_exist"] = True
    
    data["image_size"] = get_image_size(map)
    
    try:
        map_obj_type_id = map.obj_type.pk
        map_obj_name_id = map.obj_name.pk
        map_city_id = map.city.pk
    except:
        map_obj_type_id = None
        map_obj_name_id = None
        map_city_id = None
        data["map_is_exist"] = False
        return render_to_response_ex(request, "maps.html", data)

    data["objTypeChoices"] = get_map_object_type_choices(form_mode='object_type_choices2', id=map_obj_type_id)
    data["cityChoices"] = get_map_city_choices(map.city.pk)
    data["objNames"] = get_map_objnames_choices(objtype_id=map_obj_type_id, city_id=map_city_id, objname_id=map_obj_name_id)
    
    data["map_terminals"] = MapTerminal.objects.filter(map=map.pk)
    data["map_terminal_cameras"] = MapCamera.objects.filter(map=map.pk)
    
    return render_to_response_ex(request, "maps.html", data)
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:49,代码来源:views.py


注:本文中的videoclient.views.render_to_response_ex函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。