示例#1
0
文件: views.py 项目: tcqiuyu/aquam
def get_water_quality_result(request):
    location = request.__str__().split("/")[4].split("'")[0]
    location_name = location.replace("%20", " ")
    analyzer = WaterQualityAnalyzer(WaterQuality)
    # location_name = "Greeley Crescent"
    parameter = analyzer.parameters[location_name]
    coefficient = analyzer.coefficients[location_name]
    result = analyzer.get_water_quality_result(parameter, coefficient, location_name)
    return HttpResponse(json.dumps(result), content_type="application/json")
示例#2
0
文件: views.py 项目: tcqiuyu/aquam
def get_water_quality_settings(request):
    analyzer = WaterQualityAnalyzer(WaterQuality)
    result = analyzer.get_water_quality_settings()
    return HttpResponse(json.dumps(result), content_type="application/json")