views.py 文件源码

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

项目:open-semantic-search-apps 作者: opensemanticsearch 项目源码 文件源码
def edit_annotation(request):

    uri = request.GET['uri']

    annotations = Annotation.objects.filter(uri=uri)

    if annotations:

        # get first primary key of annotation with given uri
        pk = annotations[0].pk
        annotation = Annotation.objects.get(pk=pk)

        #todo: warning message if more (if racing condition on creation)

        # redirect to edit this annotation
        return HttpResponseRedirect( reverse('annotate:update', args=[pk])) # Redirect after POST

    else:
        # no annotation for that uri, so redirect to create view
        return HttpResponseRedirect( "{}?uri={}".format( reverse('annotate:create'), urllib.parse.quote_plus( uri ) ) ) # Redirect after POST



# serialize tags for uri to RDF graph
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号