mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 19:41:11 +00:00
Merge pull request #2330 from bookwyrm-social/import-admin-table
Adds more fields to import admin table and ticks version
This commit is contained in:
commit
ccf091e42d
4 changed files with 25 additions and 4 deletions
|
@ -58,6 +58,16 @@ class ImportJob(models.Model):
|
|||
"""And how many pending items??"""
|
||||
return self.pending_items.count()
|
||||
|
||||
@property
|
||||
def successful_item_count(self):
|
||||
"""How many found a book?"""
|
||||
return self.items.filter(book__isnull=False).count()
|
||||
|
||||
@property
|
||||
def failed_item_count(self):
|
||||
"""How many found a book?"""
|
||||
return self.items.filter(fail_reason__isnull=False).count()
|
||||
|
||||
|
||||
class ImportItem(models.Model):
|
||||
"""a single line of a csv being imported"""
|
||||
|
|
|
@ -11,7 +11,7 @@ from django.utils.translation import gettext_lazy as _
|
|||
env = Env()
|
||||
env.read_env()
|
||||
DOMAIN = env("DOMAIN")
|
||||
VERSION = "0.4.5"
|
||||
VERSION = "0.4.6"
|
||||
|
||||
RELEASE_API = env(
|
||||
"RELEASE_API",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{% extends 'settings/layout.html' %}
|
||||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block title %}{% trans "Imports" %}{% endblock %}
|
||||
|
||||
|
@ -54,6 +55,12 @@
|
|||
<th>
|
||||
{% trans "Pending items" %}
|
||||
</th>
|
||||
<th>
|
||||
{% trans "Successful items" %}
|
||||
</th>
|
||||
<th>
|
||||
{% trans "Failed items" %}
|
||||
</th>
|
||||
{% if status == "active" %}
|
||||
<th>{% trans "Actions" %}</th>
|
||||
{% endif %}
|
||||
|
@ -68,8 +75,10 @@
|
|||
{% if status != "active" %}
|
||||
<td>{{ import.updated_date }}</td>
|
||||
{% endif %}
|
||||
<td>{{ import.item_count }}</td>
|
||||
<td>{{ import.pending_item_count }}</td>
|
||||
<td>{{ import.item_count|intcomma }}</td>
|
||||
<td>{{ import.pending_item_count|intcomma }}</td>
|
||||
<td>{{ import.successful_item_count|intcomma }}</td>
|
||||
<td>{{ import.failed_item_count|intcomma }}</td>
|
||||
{% if status == "active" %}
|
||||
<td>
|
||||
{% join "complete" import.id as modal_id %}
|
||||
|
|
|
@ -22,7 +22,9 @@ class ImportList(View):
|
|||
def get(self, request, status="active"):
|
||||
"""list of imports"""
|
||||
complete = status == "complete"
|
||||
imports = models.ImportJob.objects.filter(complete=complete)
|
||||
imports = models.ImportJob.objects.filter(complete=complete).order_by(
|
||||
"created_date"
|
||||
)
|
||||
paginated = Paginator(imports, PAGE_LENGTH)
|
||||
page = paginated.get_page(request.GET.get("page"))
|
||||
data = {
|
||||
|
|
Loading…
Reference in a new issue