diff --git a/bookwyrm/models/bookwyrm_export_job.py b/bookwyrm/models/bookwyrm_export_job.py index d91ef6257..80912b9e3 100644 --- a/bookwyrm/models/bookwyrm_export_job.py +++ b/bookwyrm/models/bookwyrm_export_job.py @@ -123,33 +123,23 @@ def json_export(user): # pylint: disable=too-many-locals, too-many-statements book["authors"] = list(edition.first().authors.all().values()) # readthroughs book_readthroughs = ( - ReadThrough.objects.filter(user=user, book=book["id"]) - .distinct() - .values() + ReadThrough.objects.filter(user=user, book=book["id"]).distinct().values() ) book["readthroughs"] = list(book_readthroughs) # shelves - shelf_books = ShelfBook.objects.filter( - user=user, book=book["id"] - ).distinct() - shelves_from_books = Shelf.objects.filter( - shelfbook__in=shelf_books, user=user - ) + shelf_books = ShelfBook.objects.filter(user=user, book=book["id"]).distinct() + shelves_from_books = Shelf.objects.filter(shelfbook__in=shelf_books, user=user) book["shelves"] = list(shelves_from_books.values()) book["shelf_books"] = {} for shelf in shelves_from_books: - shelf_contents = ShelfBook.objects.filter( - user=user, shelf=shelf - ).distinct() + shelf_contents = ShelfBook.objects.filter(user=user, shelf=shelf).distinct() book["shelf_books"][shelf.identifier] = list(shelf_contents.values()) # book lists - book_lists = List.objects.filter( - books__in=[book["id"]], user=user - ).distinct() + book_lists = List.objects.filter(books__in=[book["id"]], user=user).distinct() book["lists"] = list(book_lists.values()) book["list_items"] = {} for blist in book_lists: @@ -180,9 +170,7 @@ def json_export(user): # pylint: disable=too-many-locals, too-many-statements # follows follows = UserFollows.objects.filter(user_subject=user).distinct() - following = User.objects.filter( - userfollows_user_object__in=follows - ).distinct() + following = User.objects.filter(userfollows_user_object__in=follows).distinct() follows = [f.remote_id for f in following] # blocks @@ -207,8 +195,8 @@ def get_books_for_user(user): """Get all the books and editions related to a user :returns: tuple of editions, books """ - all_books = Edition.viewer_aware_objects(user) - editions = all_books.filter( + + editions = Edition.objects.filter( Q(shelves__user=user) | Q(readthrough__user=user) | Q(review__user=user) diff --git a/bookwyrm/templates/import/import_user.html b/bookwyrm/templates/import/import_user.html index 8e7bb1a09..1871da84f 100644 --- a/bookwyrm/templates/import/import_user.html +++ b/bookwyrm/templates/import/import_user.html @@ -38,9 +38,32 @@ {{ import_form.archive_file }} -
-

{% trans "Importing this file will overwrite any data you currently have saved." %}

-

{% trans "Deselect any data you do not wish to include in your import. Books will always be imported" %}

+
+ {% blocktrans trimmed %} +

Deselect any checkboxes for data you do not wish to include in your import.

+

Importing this file will not delete any data but will overwrite the following information:

+ +

All other imported data will be added if it does not already exist. For example, if you have an existing list with the same name as an imported list, the existing list settings will not change, any new list items will be added, and no existing list items will be deleted.

+ + {% endblocktrans %}
diff --git a/bookwyrm/templates/preferences/export-user.html b/bookwyrm/templates/preferences/export-user.html index 2f63c9e1c..437b6c7be 100644 --- a/bookwyrm/templates/preferences/export-user.html +++ b/bookwyrm/templates/preferences/export-user.html @@ -9,16 +9,16 @@ {% block panel %}
+

+ {% trans "Your exported archive file will include all user data for import into another Bookwyrm server" %} +

{% if next_available %}

- {% blocktrans %} + {% blocktrans trimmed %} You will be able to create a new export file at {{ next_available }} {% endblocktrans %}

{% else %} -

- {% trans "Your exported archive file will include all user data for import into another Bookwyrm server" %} -

{% csrf_token %}