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
views.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录