def indexPage(request,city=None): cityObj = find_from_city(request,city) www={'id':2,'name':'互联网会','img':'http://pic.huodongjia.com/html5/pic/www.png',} jinrong={'id':6,'name':'金融会议','img':'http://pic.huodongjia.com/html5/pic/jinrong.png',} hospity={'id':23,'name':'医疗会议','img':'http://pic.huodongjia.com/html5/pic/hospity.png',} maer={'id':93,'name':'骑马运动','img':'http://pic.huodongjia.com/html5/pic/maer.png',} fly={'id':94,'name':'飞行体验','img':'http://pic.huodongjia.com/html5/pic/fly.png',} foot={'id':76,'name':'美食烹饪','img':'http://pic.huodongjia.com/html5/pic/foot.png',} child={'id':24,'name':'亲子活动','img':'http://pic.huodongjia.com/html5/pic/child.png',} snow={'id':24,'name':'滑雪活动','img':'http://pic.huodongjia.com/html5/pic/snow.png',} hot_cat=[www,jinrong,hospity,maer,fly,foot,child,snow] m_list=event_city_cat(cityObj[0]) response = render_to_response('m_home.html',{'city':cityObj[1], 'city_id':cityObj[0], 'city_py':cityObj[2], 'hot_cat':hot_cat, 'list':m_list[:5], }, context_instance=RequestContext(request)) response.set_cookie('city_id',cityObj[0]) response.set_cookie('city_py',cityObj[2]) response.set_cookie('city',cityObj[1].encode('utf-8')) response['Cache-Control'] = 'max-age=300' return response
def indexPage(request,city=None): cityObj = find_from_city(request,city) tim=2015 www={'id':2,'name':'互联网会','img':'http://pic.huodongjia.com/html5/pic/www.png?time=%s'%tim,'url':'/%s/it/' % cityObj[2] } jinrong={'id':6,'name':'金融会议','img':'http://pic.huodongjia.com/html5/pic/jinrong.png?time=%s'%tim,'url':'/%s/finance/' % cityObj[2]} hospity={'id':23,'name':'医疗会议','img':'http://pic.huodongjia.com/html5/pic/hospity.png?time=%s'%tim,'url':'/%s/medical/' % cityObj[2]} maer={'id':93,'name':'骑马运动','img':'http://pic.huodongjia.com/html5/pic/maer.png?time=%s'%tim,'url':'/tag/?keyword=骑马运动' } fly={'id':94,'name':'飞行体验','img':'http://pic.huodongjia.com/html5/pic/fly.png?time=%s'%tim,'url':'/tag/?keyword=飞行体验' } foot={'id':76,'name':'美食烹饪','img':'http://pic.huodongjia.com/html5/pic/foot.png?time=%s'%tim,'url':'/chengdu/food/'} child={'id':24,'name':'亲子活动','img':'http://pic.huodongjia.com/html5/pic/child.png?time=%s'%tim,'url':'/tag/?keyword=亲子活动'} snow={'id':24,'name':'滑雪活动','img':'http://pic.huodongjia.com/html5/pic/snow.png?time=%s'%tim,'url':'/tag/?keyword=滑雪活动'} hot_cat=[www,jinrong,hospity,maer,fly,foot,child,snow] m_list=event_city_cat(cityObj[0]) response = render_to_response('m_home.html',{'city':cityObj[1], 'city_id':cityObj[0], 'city_py':cityObj[2], 'hot_cat':hot_cat, 'list':m_list[:5], }, context_instance=RequestContext(request)) response.set_cookie('city_id',cityObj[0]) response.set_cookie('city_py',cityObj[2]) response.set_cookie('city',cityObj[1].encode('utf-8')) response['Cache-Control'] = 'max-age=300' return response
def SearchKey(request): cds = request.GET keyword = cds.get('keyword', None) city = cds.get('city', None) cityObj = find_from_city(request, city) (page, offset) = getPageAndOffset(cds) list_s = [] ids = None if not keyword: return HttpResponse(json.dumps({ "code": 0, "msg": "Only GETs are allowed", "list": [] }), content_type="application/json") if len(keyword) > 20: return HttpResponse(json.dumps({ "code": 0, "msg": "keyword Fail", "list": [] }), content_type="application/json") else: #events_lis = mc.get(keyword+'_search_lis') keyword = keyword.replace('/', ' ') ids = cache.get('_'.join(keyword.split()) + '_search_lis') if not ids: ids = search(keyword) if ids: cache.set('_'.join(keyword.split()) + '_search_lis', ids, 300) events_lis = NewEventTable.objects.filter( old_event__in=ids ) #.order_by('district_id='+str(district_id),'event_begin_time') if cityObj: events_lis = events_lis.filter(city=cityObj[0]) start = (page - 1) * offset end = page * offset list_s = [ NewformatEvent(None, item.old_event_id) for item in events_lis[start:end] ] #response = json.dumps(p) #return HttpResponse(response, mimetype="application/json") return render_to_response('m_list.html', {'list': list_s}, context_instance=RequestContext(request))
def SearchKey(request): cds = request.GET keyword = cds.get('keyword',None) city = cds.get('city',None) cityObj = find_from_city(request,city) (page,offset) = getPageAndOffset(cds) list_s=[] ids=None if not keyword: return render_to_response('not.html',{'list':list_s},context_instance=RequestContext(request)) #return HttpResponse(json.dumps({"code":0,"msg":"Only GETs are allowed","list":[]}), content_type="application/json") if len(keyword) > 20: return render_to_response('not.html',{'list':list_s},context_instance=RequestContext(request)) #return HttpResponse(json.dumps({"code":0,"msg":"keyword Fail","list":[]}), content_type="application/json") else: #events_lis = mc.get(keyword+'_search_lis') keyword= keyword.replace('/',' ') ids = cache.get('_'.join(keyword.split())+'_search_lis') if not ids: ids = search(keyword) if ids: cache.set('_'.join(keyword.split())+'_search_lis',ids,300) events_lis = NewEventTable.objects.filter(old_event__in = ids)#.order_by('district_id='+str(district_id),'event_begin_time') if cityObj: events_lis = events_lis.filter(city=cityObj[0]) start = (page-1)*offset end = page*offset list_s = [NewformatEvent(None,item.old_event_id) for item in events_lis[start:end]] #response = json.dumps(p) #return HttpResponse(response, mimetype="application/json") head = {'title':u'%s_门票预订_报名参加_活动网_活动家'%(keyword), 'keywords':u'%s,门票,报名,活动网,活动家'%(keyword), 'description':u'找%s相关近期活动,就上【活动家www.huodongjia.com】。活动家为您提供%s相关活动信息,包含门票预订、报名参加、价格咨询等全方位服务,实时更新%s最新活动,随时随地轻松购票!服务热线:400-003-3879'%(keyword,keyword,keyword)} if len(list_s)>0: return render_to_response('m_tag.html',{'head':head,'city':request.COOKIES.get('city',u'北京'),'city_py':request.COOKIES.get('city_py','beijing'),'list':list_s,'len_list':len(list_s),'keyword':keyword,'page':page,'offset':offset},context_instance=RequestContext(request)) else: return render_to_response('not.html',{'list':list_s},context_instance=RequestContext(request))
def SearchKey_ajax(request): cds = request.GET keyword = cds.get('keyword',None) city = cds.get('city',None) cityObj = find_from_city(request,city) (page,offset) = getPageAndOffset(cds) p={} if not keyword: return HttpResponse(json.dumps({"code":0,"msg":"Only GETs are allowed","list":[]}), content_type="application/json") if len(keyword) > 20: return HttpResponse(json.dumps({"code":0,"msg":"keyword Fail","list":[]}), content_type="application/json") else: #events_lis = mc.get(keyword+'_search_lis') keyword= keyword.replace('/',' ') ids = cache.get('_'.join(keyword.split())+'_search_lis') p['code']=1 p['msg']='Request is successful' p['keys']=keyword p['list'] =[] if not ids: ids = search(keyword) if ids: cache.set('_'.join(keyword.split())+'_search_lis',ids,300) events_lis = NewEventTable.objects.filter(old_event__in = ids)#.order_by('district_id='+str(district_id),'event_begin_time') if cityObj: events_lis = events_lis.filter(city=cityObj[0]) start = (page-1)*offset end = page*offset p['list'] = [NewformatEvent(None,item.old_event_id) for item in events_lis[start:end]] p['page']=page+1 response = json.dumps(p) return HttpResponse(response, mimetype="application/json")
def SearchKey(request): cds = request.GET keyword = cds.get('keyword',None) city = cds.get('city',None) cityObj = find_from_city(request,city) (page,offset) = getPageAndOffset(cds) list_s=[] ids=None if not keyword: return HttpResponse(json.dumps({"code":0,"msg":"Only GETs are allowed","list":[]}), content_type="application/json") if len(keyword) > 20: return HttpResponse(json.dumps({"code":0,"msg":"keyword Fail","list":[]}), content_type="application/json") else: #events_lis = mc.get(keyword+'_search_lis') keyword= keyword.replace('/',' ') ids = cache.get('_'.join(keyword.split())+'_search_lis') if not ids: ids = search(keyword) if ids: cache.set('_'.join(keyword.split())+'_search_lis',ids,300) events_lis = NewEventTable.objects.filter(old_event__in = ids)#.order_by('district_id='+str(district_id),'event_begin_time') if cityObj: events_lis = events_lis.filter(city=cityObj[0]) start = (page-1)*offset end = page*offset list_s = [NewformatEvent(None,item.old_event_id) for item in events_lis[start:end]] #response = json.dumps(p) #return HttpResponse(response, mimetype="application/json") return render_to_response('m_list.html',{'list':list_s},context_instance=RequestContext(request))
def homePage(request, city_title=False): #cityId = 45052 #city_name = u'北京' #title = 'beijing' if not city_title: cityObj = (None, 0, '') else: cityObj = find_from_city(request, city_title) left = event_city_cat(cityObj[0], 69, True) #right=event_city_cat(cityObj[0],(19,70) ) #return render_to_response('base_error.html',{'error_msg':left}) #special_dic_list = right [:12] business_dic_list = left[:12] ''' r= len(special_dic_list)-8 if r<0: rb = event_city_cat(cityObj[0],70 ) special_dic_list.extend(rb[:abs(r)] ) l= len(business_dic_list)-8 if l<0: b = event_city_cat(cityObj[0],(19,69) ) business_dic_list.extend(b[:abs(l)] ) #return render_to_response('base_error.html',{'error_msg':b}) ''' # 获取视频,按照end_time排序,只取6个 video = NewEventParagraph.objects.filter( cat_name_id=17543).order_by('-end_time') def setUrl(v): v.video_url = '/video-' + str(v.id) + '.html' return v video_list = map(setUrl, video[:7]) #return render_to_response('base_error.html',{'error_msg':special_dic_list}) head = { 'title': u'活动家-亚洲最大的活动网聚合平台-全面、安全、快捷、方便_认准活动家官方网站', 'keywords': u'活动家,网上订票,会议网,活动网,亲子活动,活动,同城活动', 'description': u'活动网为您提供海量会议,公开课,会展,极限运动,当地体验,夜生活,演出折扣票,同城活动查询,特色旅游,门票预订,报名,参加活动,每日发布最新活动,发布活动请上活动家!服务热线:400-003-3879' } hot_links = get_site_hot_links() hot_links_new = [] for ev in hot_links: try: if datetime.datetime.strptime( ev[5], '%Y-%m-%d %H:%M:%S') < datetime.datetime.now(): continue except: pass try: if datetime.datetime.strptime( ev[4], '%Y-%m-%d %H:%M:%S') > datetime.datetime.now(): continue except: pass #ev[0]='%s%s' % (ev[0],ev[5]) hot_links_new.append(ev) ########### def judge(string): for c in string: if c.isdigit(): return False return True meetings = NewCatUrl(0, '', True)['business'] i = 0 length = len(meetings['child']) while i < length: nav = meetings['child'][i] if not judge(nav['caturl']) or meetings['child'][i]['ename'] in [ 'meeting', 'training', 'expo' ]: del meetings['child'][i] #nav['caturl'] += 'del' length -= 1 else: i += 1 ########### if city_title: cn = cityObj[1] head = {'title':u'%s商务会议网_%s同城活动网_%s活动家' % (cn, cn, cn), 'keywords':u'%s会议网,%s同城活动,%s商务活动,%s活动' % (cn, \ cn, cn, cn), 'description':u'找%s会议、活动,上活动家Huodongjia.com!活动家是%s最大商务活动网站,提供%s地区专业商务会议、同城活动的查询与报名服务,涵盖IT、医疗、金融财经、能源化工、农业林业等行业优质商务会议,美食体验、极限运动、亲子活动、娱乐演出等优质同城活动,在线订票,免费发布活动,全面、安全、快捷、方便,认准活动家官方网站!服务热线:400-003-3879' % \ (cn, cn, cn) } else: head = { 'title': u'活动家-专业商务会议网-亚洲最大活动网站', 'keywords': u'活动网,会议网,商务活动,商务会议,活动家', 'description': u'找会议,上活动家Huodongjia.com!活动家是亚洲最大商务活动网站,提供专业商务会议、同城活动的查询与报名服务,涵盖IT、医疗、金融财经、能源化工、农业林业等行业优质商务会议,美食体验、极限运动、亲子活动、娱乐演出等优质同城活动,在线订票,免费发布活动,全面、安全、快捷、方便,认准活动家官方网站!服务热线:400-003-3879' } ########## bay = { 'city': cityObj[1], 'city_id': cityObj[0], 'city_py': cityObj[2], 'hot_links': hot_links_new[:5], #'special_list':special_dic_list, 'business_list': business_dic_list, 'video_list': video_list, 'meeting': meetings, 'head': head, 'background_img': '../images/head_background/header_background.png' } links = get_site_links() bay['site_links'] = [] for li in range(len(links)): ##### #### ### try: if 0 < len(links[li][4]): for l in links[li][4]: if l == city_title: # 分类过滤,有分类信息就显示设置分类的友情链接,没有分类的同理 # 首页不带分类信息 if len(links[li][5]) == 0: bay['site_links'].append(links[li]) break else: #pass #无城市信息就显示没有设置城市的友情链接 #有城市信息就显示设置有该城市的友情链接 if not city_title: # 分类过滤,有分类信息就显示设置分类的友情链接,没有分类的同理 # 首页不带分类信息 if len(links[li][5]) == 0: bay['site_links'].append(links[li]) except IndexError: # 由于get_site_links内部实现改了,所以link[li][4]和link[li][5]不会引发索引越界异常了 # 这里是不可能到达的 bay['site_links'].append(links[li]) # bay['list'] = spot.list.showList(request, False, 'all', 'latest', 1)['list'] \ + spot.list.showList(request, False, 'all', 'latest', 2)['list'] for item in bay['list'][:6]: item['spot_name'] = item['spot_name'].replace(u'会议报告:', '') # ############ # 读取广告 ############ ads_pos_1 = get_image_ads(1) ads_pos_2 = get_image_ads(2) ads_pos_3 = get_image_ads(3) def set_url(ia): try: ia.pic_url = ia.pic.server.name + ia.pic.urls except AttributeError: if ia.pic is not None: ia.pic_url = "http://pic.huodongjia.com/" + ia.pic.urls else: ia.pic_url = "" return ia ads_in_1 = map(set_url, ads_pos_1) ads_in_2 = map(set_url, ads_pos_2) ads_in_3 = map(set_url, ads_pos_3) bay['ads1'] = ads_in_1 bay['ads2'] = ads_in_2 bay['ads3'] = ads_in_3 response = render_to_response('home.html', bay, context_instance=RequestContext(request)) ''' response.set_cookie('city_id',cityObj[0]) response.set_cookie('city_py',cityObj[2]) response.set_cookie('city',cityObj[1].encode('utf-8')) response['Cache-Control'] = 'max-age=300' ''' return response
def homePage(request,city_title=False): #cityId = 45052 #city_name = u'北京' #title = 'beijing' if not city_title: cityObj=(None, 0, '') else: cityObj = find_from_city(request,city_title) left=event_city_cat(cityObj[0], 69, True) #right=event_city_cat(cityObj[0],(19,70) ) #return render_to_response('base_error.html',{'error_msg':left}) #special_dic_list = right [:12] business_dic_list = left [:12] ''' r= len(special_dic_list)-8 if r<0: rb = event_city_cat(cityObj[0],70 ) special_dic_list.extend(rb[:abs(r)] ) l= len(business_dic_list)-8 if l<0: b = event_city_cat(cityObj[0],(19,69) ) business_dic_list.extend(b[:abs(l)] ) #return render_to_response('base_error.html',{'error_msg':b}) ''' # 获取视频,按照end_time排序,只取6个 video = NewEventParagraph.objects.filter(cat_name_id=17543).order_by('-end_time') def setUrl(v): v.video_url = '/video-' + str(v.id) + '.html' return v video_list = map(setUrl, video[:7]) #return render_to_response('base_error.html',{'error_msg':special_dic_list}) head = {'title':u'活动家-亚洲最大的活动网聚合平台-全面、安全、快捷、方便_认准活动家官方网站' , 'keywords':u'活动家,网上订票,会议网,活动网,亲子活动,活动,同城活动' , 'description':u'活动网为您提供海量会议,公开课,会展,极限运动,当地体验,夜生活,演出折扣票,同城活动查询,特色旅游,门票预订,报名,参加活动,每日发布最新活动,发布活动请上活动家!服务热线:400-003-3879' } hot_links=get_site_hot_links() hot_links_new=[] for ev in hot_links: try: if datetime.datetime.strptime(ev[5],'%Y-%m-%d %H:%M:%S')<datetime.datetime.now(): continue except: pass try: if datetime.datetime.strptime(ev[4],'%Y-%m-%d %H:%M:%S')> datetime.datetime.now(): continue except: pass #ev[0]='%s%s' % (ev[0],ev[5]) hot_links_new.append(ev) ########### def judge(string): for c in string: if c.isdigit(): return False return True meetings = NewCatUrl(0,'',True)['business'] i = 0 length = len(meetings['child']) while i < length: nav = meetings['child'][i] if not judge(nav['caturl']) or meetings['child'][i]['ename'] in ['meeting','training','expo']: del meetings['child'][i] #nav['caturl'] += 'del' length -= 1 else: i += 1 ########### if city_title: cn = cityObj[1] head = {'title':u'%s商务会议网_%s同城活动网_%s活动家' % (cn, cn, cn), 'keywords':u'%s会议网,%s同城活动,%s商务活动,%s活动' % (cn, \ cn, cn, cn), 'description':u'找%s会议、活动,上活动家Huodongjia.com!活动家是%s最大商务活动网站,提供%s地区专业商务会议、同城活动的查询与报名服务,涵盖IT、医疗、金融财经、能源化工、农业林业等行业优质商务会议,美食体验、极限运动、亲子活动、娱乐演出等优质同城活动,在线订票,免费发布活动,全面、安全、快捷、方便,认准活动家官方网站!服务热线:400-003-3879' % \ (cn, cn, cn) } else: head = {'title':u'活动家-专业商务会议网-亚洲最大活动网站' , 'keywords':u'活动网,会议网,商务活动,商务会议,活动家' , 'description':u'找会议,上活动家Huodongjia.com!活动家是亚洲最大商务活动网站,提供专业商务会议、同城活动的查询与报名服务,涵盖IT、医疗、金融财经、能源化工、农业林业等行业优质商务会议,美食体验、极限运动、亲子活动、娱乐演出等优质同城活动,在线订票,免费发布活动,全面、安全、快捷、方便,认准活动家官方网站!服务热线:400-003-3879' } ########## bay={'city':cityObj[1], 'city_id':cityObj[0], 'city_py':cityObj[2], 'hot_links':hot_links_new[:5], #'special_list':special_dic_list, 'business_list':business_dic_list, 'video_list': video_list, 'meeting': meetings, 'head':head, 'background_img':'../images/head_background/header_background.png'} links=get_site_links() bay['site_links']=[] for li in range(len(links)): ##### #### ### try: if 0 < len(links[li][4]): for l in links[li][4]: if l == city_title: bay['site_links'].append(links[li]) break else: #pass #无城市信息就显示没有设置城市的友情链接 #有城市信息就显示设置有该城市的友情链接 if not city_title: bay['site_links'].append(links[li]) except: #pass bay['site_links'].append(links[li]) # bay['list'] = spot.list.showList(request, False, 'all', 'latest', 1)['list'] \ + spot.list.showList(request, False, 'all', 'latest', 2)['list'] for item in bay['list'][:6]: item['spot_name'] = item['spot_name'].replace(u'会议报告:', '') # ############ # 读取广告 ############ ads_pos_1 = get_image_ads(1) ads_pos_2 = get_image_ads(2) ads_pos_3 = get_image_ads(3) def set_url(ia): try: ia.pic_url = ia.pic.server.name + ia.pic.urls except AttributeError: if ia.pic is not None: ia.pic_url = "http://pic.huodongjia.com/" + ia.pic.urls else: ia.pic_url = "" return ia ads_in_1 = map(set_url, ads_pos_1) ads_in_2 = map(set_url, ads_pos_2) ads_in_3 = map(set_url, ads_pos_3) bay['ads1'] = ads_in_1 bay['ads2'] = ads_in_2 bay['ads3'] = ads_in_3 response = render_to_response('home.html',bay, context_instance=RequestContext(request)) ''' response.set_cookie('city_id',cityObj[0]) response.set_cookie('city_py',cityObj[2]) response.set_cookie('city',cityObj[1].encode('utf-8')) response['Cache-Control'] = 'max-age=300' ''' return response
def searchKeyword(request, offset=15, page=1, isTag=False): #mc = memcache.Client(['127.0.0.1:11211']) cityObj = find_from_city(request) title = cityObj[2] city_name = cityObj[1] district_id = cityObj[0] if offset < 1 or page < 1: return render_to_response('base_error.html', {'error_msg': u'页码错误'}, context_instance=RequestContext(request)) offset = int(offset) page = int(page) error = u'你什么都没有输入' if request.GET.get('keyword', ''): keyword = request.GET['keyword'] #keyword = keyword.encode('utf8') #print keyword.encode('utf8') if keyword: if page == 1 and not isTag: if request.META.has_key('HTTP_X_FORWARDED_FOR'): ip = request.META['HTTP_X_FORWARDED_FOR'] else: ip = request.META['REMOTE_ADDR'] SysSearchKey.objects.create(keyword=keyword, ip=ip, search_time=time.time()) if len(keyword) > 20: error = u'关键词的字数不能超过20' else: #events_lis = mc.get(keyword+'_search_lis') keyword = keyword.replace('/', ' ') events_lis = cache.get('_'.join(keyword.split()) + '_search_lis') if not events_lis: ids = search(keyword) if ids: events_lis = SysEvent.objects.filter( event_id__in=ids ) #.order_by('district_id='+str(district_id),'event_begin_time') cache.set('_'.join(keyword.split()) + '_search_lis', events_lis, 300) if events_lis: events_lis = events_lis.extra( select={'is_top': 'district_id=' + str(district_id)}) events_lis = events_lis.extra(order_by=['-is_top']) #print connection.queries count = events_lis.count() if count % offset: page_number = count / offset + 1 else: page_number = count / offset rlist = [ formatEvent(item) for item in events_lis[offset * (page - 1):offset * page] ] if not isTag: url = '/search/' + str( offset) + '/page/?keyword=' + keyword else: url = '/tag/' + str( offset) + '/page/?keyword=' + keyword #print page_number pageList = [] for i in range(1, page_number + 1): curPageFlg = False if page == i: curPageFlg = True pageDict = { 'page': i, 'pageurl': url.replace('page', str(i)), 'flag': curPageFlg } pageList.append(pageDict) if page <= 1: firstPage = False prePage = False else: firstPage = pageList[0] prePage = pageList[page - 2] if page >= page_number: lastPage = False nextPage = False else: lastPage = pageList[page_number - 1] nextPage = pageList[page] #print pageList head = { 'title': u'%s_门票预订_报名参加_活动网_活动家' % (keyword), 'keywords': u'%s' % (keyword), 'description': u'报名参加购买%s活动门票请上活动家(huodongjia.com)' % (keyword) } return render_to_response( 'search_results.html', { 'list': rlist, 'city': city_name, 'city_py': title, 'keyword': keyword, 'firstPage': firstPage, 'prePage': prePage, 'currentPage': page, 'nextPage': nextPage, 'lastPage': lastPage, 'pageList': pageList, 'head': head }) else: error = u'没能搜索到与"%s"相关的活动,你可以尝试其他搜索' % keyword clist = [] for i in [20, 21, 22, 23, 89, 90]: cl = cache.get('rec_with_cat_%s' % i) if cl: for j in cl: if not random.randint(0, 8): clist.append(j) rlist = [formatEvent(item) for item in clist] if clist: message = u'你可能感兴趣的活动' else: message = '' return render_to_response( 'search_results.html', { 'error_msg': error, 'message': message, 'city': city_name, 'city_py': title, 'list': rlist }, context_instance=RequestContext(request)) else: error = u'输入不能为空' return render_to_response('search_results.html', { 'error_msg': error, 'city': city_name, 'city_py': title }, context_instance=RequestContext(request))