views.py 文件源码

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

项目:TranskribusWebUI 作者: Transkribus 项目源码 文件源码
def ingest_mets_url(request):
    if request.method == 'POST':
        # What should be checked here and what can be left up to Transkribus?
        if (t_ingest_mets_url(request.POST.get('collection'), request.POST.get('url'))):
            messages.info(request, 'URL is being processed.')# TODO i18n,
            return HttpResponse(json.dumps({'RESET': 'true', 'MESSAGE': render_to_string('library/message_modal.html', request=request)}), content_type='text/plain')
        else:
            messages.error(request, 'URL processing failed.')# TODO i18n,
            return HttpResponse(json.dumps({'RESET': 'false', 'MESSAGE': render_to_string('library/message_modal.html', request=request)}), content_type='text/plain')
    else:
        data = {'url': request.GET.get('metsURL', '')}
        ingest_mets_url_form = IngestMetsUrlForm(initial=data)
        collections = t_collections(request)
        if isinstance(collections,HttpResponse):
            return collections

        return render(request, 'library/ingest_mets_url.html', {'ingest_mets_url_form': ingest_mets_url_form, 'collections': collections})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号