views.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:DeepOSM 作者: trailbehind 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号