views.py 文件源码

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

项目:admintools 作者: openstates 项目源码 文件源码
def create_person_patch(request, jur_id):
    if request.method == 'POST':
        p = Person.objects.get(id=request.POST['person'])
        # if any error occur then `create` will throw error.
        IssueResolverPatch.objects.create(
            content_object=p,
            jurisdiction_id=jur_id,
            status='unreviewed',
            old_value=request.POST['old_value'],
            new_value=request.POST['new_value'],
            source=request.POST.get('source'),
            category=request.POST['category'],
            alert='error',
            note=request.POST.get('note'),
            applied_by='admin',
        )
        messages.success(request, "Successfully created Patch")
    people = Person.objects.filter(
        memberships__organization__jurisdiction_id=jur_id).distinct()
    context = {'jur_id': jur_id,
               'people': people}
    return render(request, 'admintools/create_person_patch.html', context)


# Data Quality Exceptions
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号