forked from mirrors/bookwyrm
parent
e4b815d276
commit
9a67c61487
2 changed files with 8 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
||||||
{% block content %}{% spaceless %}
|
{% block content %}{% spaceless %}
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h1 class="title">{% trans "Import Status" %}</h1>
|
<h1 class="title">{% trans "Import Status" %}</h1>
|
||||||
|
<a href="{% url 'import' %}" class="has-text-weight-normal help subtitle is-link">{% trans "Back to imports" %}</a>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<div class="is-flex">
|
<div class="is-flex">
|
||||||
|
@ -106,7 +107,11 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="block">
|
<div class="block">
|
||||||
|
{% if job.complete %}
|
||||||
<h2 class="title is-4">{% trans "Successfully imported" %}</h2>
|
<h2 class="title is-4">{% trans "Successfully imported" %}</h2>
|
||||||
|
{% else %}
|
||||||
|
<h2 class="title is-4">{% trans "Import Progress" %}</h2>
|
||||||
|
{% endif %}
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
|
|
|
@ -78,13 +78,15 @@ class ImportStatus(View):
|
||||||
|
|
||||||
def get(self, request, job_id):
|
def get(self, request, job_id):
|
||||||
"""status of an import job"""
|
"""status of an import job"""
|
||||||
job = models.ImportJob.objects.get(id=job_id)
|
job = get_object_or_404(models.ImportJob, id=job_id)
|
||||||
if job.user != request.user:
|
if job.user != request.user:
|
||||||
raise PermissionDenied
|
raise PermissionDenied
|
||||||
|
|
||||||
try:
|
try:
|
||||||
task = app.AsyncResult(job.task_id)
|
task = app.AsyncResult(job.task_id)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
task = None
|
task = None
|
||||||
|
|
||||||
items = job.items.order_by("index").all()
|
items = job.items.order_by("index").all()
|
||||||
failed_items = [i for i in items if i.fail_reason]
|
failed_items = [i for i in items if i.fail_reason]
|
||||||
items = [i for i in items if not i.fail_reason]
|
items = [i for i in items if not i.fail_reason]
|
||||||
|
|
Loading…
Reference in a new issue