mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-20 00:21:04 +00:00
Merge branch 'cthulahoops-large_imports'
This commit is contained in:
commit
d8934879e9
4 changed files with 8 additions and 4 deletions
|
@ -7,8 +7,8 @@ from fedireads.tasks import app
|
|||
from fedireads.models import ImportJob, ImportItem
|
||||
from fedireads.status import create_notification
|
||||
|
||||
# TODO: remove or notify about this in the UI
|
||||
MAX_ENTRIES = 20
|
||||
# TODO: remove or increase once we're confident it's not causing problems.
|
||||
MAX_ENTRIES = 500
|
||||
|
||||
|
||||
def create_job(user, csv_file):
|
||||
|
|
|
@ -61,7 +61,7 @@ class ImportItem(models.Model):
|
|||
def get_book_from_db_isbn(self):
|
||||
''' see if we already know about the book '''
|
||||
try:
|
||||
return Edition.objects.get(isbn_13=self.isbn)
|
||||
return Edition.objects.filter(isbn_13=self.isbn).first()
|
||||
except Edition.DoesNotExist:
|
||||
return None
|
||||
|
||||
|
@ -89,7 +89,7 @@ class ImportItem(models.Model):
|
|||
def shelf(self):
|
||||
''' the goodreads shelf field '''
|
||||
if self.data['Exclusive Shelf']:
|
||||
return GOODREADS_SHELVES[self.data['Exclusive Shelf']]
|
||||
return GOODREADS_SHELVES.get(self.data['Exclusive Shelf'])
|
||||
|
||||
@property
|
||||
def review(self):
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
{{ import_form.as_p }}
|
||||
<button type="submit">Import</button>
|
||||
</form>
|
||||
<p>
|
||||
Imports are limited in size, and only the first {{ limit }} items will be imported.
|
||||
|
||||
<h2>Recent Imports</h2>
|
||||
<ul>
|
||||
|
|
|
@ -9,6 +9,7 @@ from django.views.decorators.csrf import csrf_exempt
|
|||
|
||||
from fedireads import activitypub
|
||||
from fedireads import forms, models, books_manager
|
||||
from fedireads import goodreads_import
|
||||
from fedireads.tasks import app
|
||||
|
||||
|
||||
|
@ -162,6 +163,7 @@ def import_page(request):
|
|||
'import_form': forms.ImportForm(),
|
||||
'jobs': models.ImportJob.
|
||||
objects.filter(user=request.user).order_by('-created_date'),
|
||||
'limit': goodreads_import.MAX_ENTRIES,
|
||||
})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue