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})
评论列表
文章目录