def history(request):
username = auth.get_user(request).username
if (username):
?t = city.objects.all().values()
co = country.objects.all().values()
city_json = json.dumps(list(?t), cls=DjangoJSONEncoder,ensure_ascii=False)
country_json = json.dumps(list(co), cls=DjangoJSONEncoder,ensure_ascii=False)
args={}
args['city']=city_json
args['country'] = country_json
args['max_date'] = []
for i in ?t:
args['max_date'].append((temperature.objects.filter(city_id__exact=i['city_id']).latest('date').date))
return render_to_response("history.html",args)
else:
return redirect("/login")
评论列表
文章目录