def view_error(request, analysis_type, country_abbrev, state_name, error_id):
"""View the error with the given error_id."""
error = models.MapError.objects.get(id=error_id)
if request.POST:
if request.GET.get('flag_error'):
error.flagged_count += 1
error.save()
context = {
'center': ((error.ne_lon + error.sw_lon) / 2, (error.ne_lat + error.sw_lat) / 2),
'error': error,
'country_abbrev': country_abbrev,
'state_title': state_name.replace('-', ' ').title(),
'state_name': state_name,
'analysis_title': analysis_type.replace('-', ' ').title(),
'analysis_type': analysis_type
}
template = loader.get_template('view_error.html')
return HttpResponse(template.render(context, request))
评论列表
文章目录