forked from mirrors/bookwyrm
parent
e4b815d276
commit
9a67c61487
2 changed files with 8 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
|||
{% block content %}{% spaceless %}
|
||||
<div class="block">
|
||||
<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>
|
||||
<div class="is-flex">
|
||||
|
@ -106,7 +107,11 @@
|
|||
{% endif %}
|
||||
|
||||
<div class="block">
|
||||
{% if job.complete %}
|
||||
<h2 class="title is-4">{% trans "Successfully imported" %}</h2>
|
||||
{% else %}
|
||||
<h2 class="title is-4">{% trans "Import Progress" %}</h2>
|
||||
{% endif %}
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
|
|
|
@ -78,13 +78,15 @@ class ImportStatus(View):
|
|||
|
||||
def get(self, request, job_id):
|
||||
"""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:
|
||||
raise PermissionDenied
|
||||
|
||||
try:
|
||||
task = app.AsyncResult(job.task_id)
|
||||
except ValueError:
|
||||
task = None
|
||||
|
||||
items = job.items.order_by("index").all()
|
||||
failed_items = [i for i in items if i.fail_reason]
|
||||
items = [i for i in items if not i.fail_reason]
|
||||
|
|
Loading…
Reference in a new issue