Merge pull request #1171 from bookwyrm-social/import-text

Clarifies wording on pending imports
This commit is contained in:
Mouse Reeve 2021-06-14 12:31:38 -07:00 committed by GitHub
commit d4e2a06092
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -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>

View file

@ -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]