def main(request,content={}): print(request.session['hotelID']) #bbox = json.dumps(TelMap.extent()) #mapgeo=get_Geojson('2014-01-01',22) populationjson=None if(len(content)>0): populationjson=content["populationjson"] raw=content["date"].replace("-","") pophour=content["hour"] else: raw=datetime.datetime.now(pytz.timezone('Europe/Madrid')).strftime("%Y%m%d%H%M%S") pophour=datetime.datetime.now(pytz.timezone('Europe/Madrid')).strftime("%H") if request.is_ajax(): return HttpResponse(populationjson, mimetype='application/json') else: if request.GET.get('id',None): form = testFormBootstrap3(instance=testFormBootstrap3.objects.get(id=request.GET.get('id',None))) else: form = testFormBootstrap3() print(raw) popyear=str(raw)[0:4] popmonth=str(raw)[4:6] popday=str(raw)[6:8] #I am just passing a hotelId for the demo userHotel=getUserHotel(request.session['hotelID']) ######### userHotelJson=json.dumps(userHotel, cls=MongoAwareEncoder, ensure_ascii=False) return render_to_response('map.html',{"populationjson":populationjson,'userHotelJson':userHotelJson,'popyear':popyear,'popmonth':popmonth,'popday':popday,'pophour':pophour,'form': form,'bootstrap':3}, context_instance=RequestContext(request))
def dateTimeViewBootstrap3(request): if request.method == 'POST': # If the form has been submitted... form = testFormBootstrap3(request.POST) # A form bound to the POST data if form.is_valid(): # All validation rules pass return render(request, 'map.html', {'form': form,'bootstrap':3}) else: if request.GET.get('id',None): form = testFormBootstrap3(instance=testFormBootstrap3.objects.get(id=request.GET.get('id',None))) else: form = testFormBootstrap3() return render(request, 'map.html', {'form': form,'bootstrap':3})