From 2b27889457bfb213742db7e9bf8c516bc634d0e7 Mon Sep 17 00:00:00 2001 From: Thomas Versteeg Date: Fri, 11 Feb 2022 14:33:46 +0100 Subject: [PATCH 01/15] Add 'Partially Read' shelf --- .../migrations/0134_alter_partially_read.py | 29 +++++++++++++ bookwyrm/models/shelf.py | 3 +- bookwyrm/models/status.py | 2 +- bookwyrm/models/user.py | 4 ++ .../templates/get_started/book_preview.html | 1 + bookwyrm/templates/shelf/shelf.html | 1 + .../reading_modals/partially_read_modal.html | 42 +++++++++++++++++++ .../templates/snippets/shelf_selector.html | 10 +++++ .../snippets/shelve_button/shelve_button.html | 3 ++ .../shelve_button_dropdown_options.html | 7 ++++ .../shelve_button/shelve_button_options.html | 7 ++++ .../snippets/translated_shelf_name.html | 2 + bookwyrm/templates/user/user.html | 3 +- bookwyrm/tests/models/test_user_model.py | 2 + bookwyrm/urls.py | 2 +- bookwyrm/views/reading.py | 2 + 16 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 bookwyrm/migrations/0134_alter_partially_read.py create mode 100644 bookwyrm/templates/snippets/reading_modals/partially_read_modal.html diff --git a/bookwyrm/migrations/0134_alter_partially_read.py b/bookwyrm/migrations/0134_alter_partially_read.py new file mode 100644 index 00000000..85e9ed9f --- /dev/null +++ b/bookwyrm/migrations/0134_alter_partially_read.py @@ -0,0 +1,29 @@ +# Generated by Django 3.2.11 on 2022-02-11 13:19 + +import bookwyrm.models.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0133_alter_listitem_notes'), + ] + + operations = [ + migrations.AlterField( + model_name='comment', + name='reading_status', + field=bookwyrm.models.fields.CharField(blank=True, choices=[('to-read', 'To-Read'), ('reading', 'Reading'), ('read', 'Read'), ('partially-read', 'Partially-Read')], max_length=255, null=True), + ), + migrations.AlterField( + model_name='quotation', + name='reading_status', + field=bookwyrm.models.fields.CharField(blank=True, choices=[('to-read', 'To-Read'), ('reading', 'Reading'), ('read', 'Read'), ('partially-read', 'Partially-Read')], max_length=255, null=True), + ), + migrations.AlterField( + model_name='review', + name='reading_status', + field=bookwyrm.models.fields.CharField(blank=True, choices=[('to-read', 'To-Read'), ('reading', 'Reading'), ('read', 'Read'), ('partially-read', 'Partially-Read')], max_length=255, null=True), + ), + ] diff --git a/bookwyrm/models/shelf.py b/bookwyrm/models/shelf.py index 320d495d..4c57eb96 100644 --- a/bookwyrm/models/shelf.py +++ b/bookwyrm/models/shelf.py @@ -17,8 +17,9 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel): TO_READ = "to-read" READING = "reading" READ_FINISHED = "read" + PARTIALLY_READ = "partially-read" - READ_STATUS_IDENTIFIERS = (TO_READ, READING, READ_FINISHED) + READ_STATUS_IDENTIFIERS = (TO_READ, READING, READ_FINISHED, PARTIALLY_READ) name = fields.CharField(max_length=100) identifier = models.CharField(max_length=100) diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index 29b3ba9c..99756df5 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -265,7 +265,7 @@ class GeneratedNote(Status): ReadingStatusChoices = models.TextChoices( - "ReadingStatusChoices", ["to-read", "reading", "read"] + "ReadingStatusChoices", ["to-read", "reading", "read", "partially-read"] ) diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index 6367dcae..223bad0f 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -372,6 +372,10 @@ class User(OrderedCollectionPageMixin, AbstractUser): "name": "Read", "identifier": "read", }, + { + "name": "Partially Read", + "identifier": "partially-read", + }, ] for shelf in shelves: diff --git a/bookwyrm/templates/get_started/book_preview.html b/bookwyrm/templates/get_started/book_preview.html index 8a20d0d7..51a5a4e6 100644 --- a/bookwyrm/templates/get_started/book_preview.html +++ b/bookwyrm/templates/get_started/book_preview.html @@ -10,6 +10,7 @@ {% if shelf.identifier == 'to-read' %}{% trans "To Read" %} {% elif shelf.identifier == 'reading' %}{% trans "Currently Reading" %} {% elif shelf.identifier == 'read' %}{% trans "Read" %} + {% elif shelf.identifier == 'partially-read' %}{% trans "Partially Read" %} {% else %}{{ shelf.name }}{% endif %} {% endfor %} diff --git a/bookwyrm/templates/shelf/shelf.html b/bookwyrm/templates/shelf/shelf.html index cc4bb143..67faf0a4 100644 --- a/bookwyrm/templates/shelf/shelf.html +++ b/bookwyrm/templates/shelf/shelf.html @@ -86,6 +86,7 @@ {% if shelf.identifier == 'to-read' %}{% trans "To Read" %} {% elif shelf.identifier == 'reading' %}{% trans "Currently Reading" %} {% elif shelf.identifier == 'read' %}{% trans "Read" %} + {% elif shelf.identifier == 'partially-read' %}{% trans "Partially Read" %} {% else %}{{ shelf.name }}{% endif %} {% include 'snippets/privacy-icons.html' with item=shelf %} diff --git a/bookwyrm/templates/snippets/reading_modals/partially_read_modal.html b/bookwyrm/templates/snippets/reading_modals/partially_read_modal.html new file mode 100644 index 00000000..60c39c40 --- /dev/null +++ b/bookwyrm/templates/snippets/reading_modals/partially_read_modal.html @@ -0,0 +1,42 @@ +{% extends 'snippets/reading_modals/layout.html' %} +{% load i18n %} +{% load utilities %} + +{% block modal-title %} +{% blocktrans trimmed with book_title=book|book_title %} +Partially Read "{{ book_title }}" +{% endblocktrans %} +{% endblock %} + +{% block modal-form-open %} +
+{% csrf_token %} + + + +{% endblock %} + +{% block reading-dates %} +
+
+
+ + +
+
+
+
+ + +
+
+
+{% endblock %} + +{% block form %} +{% include "snippets/reading_modals/form.html" with optional=True type="partially_read_model" %} +{% endblock %} diff --git a/bookwyrm/templates/snippets/shelf_selector.html b/bookwyrm/templates/snippets/shelf_selector.html index 197cf5b6..7589ffc6 100644 --- a/bookwyrm/templates/snippets/shelf_selector.html +++ b/bookwyrm/templates/snippets/shelf_selector.html @@ -49,6 +49,13 @@ {% join "finish_reading" uuid as modal_id %} {% include 'snippets/shelve_button/modal_button.html' with class=button_class fallback_url=fallback_url %} +{% elif shelf.identifier == 'partially-read' %} + +{% trans "Partially read" as button_text %} +{% url 'reading-status' 'stop' book.id as fallback_url %} +{% join "partially_read" uuid as modal_id %} +{% include 'snippets/shelve_button/modal_button.html' with class=button_class fallback_url=fallback_url %} + {% elif shelf.identifier == 'to-read' %} {% trans "Want to read" as button_text %} @@ -97,5 +104,8 @@ {% join "finish_reading" uuid as modal_id %} {% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book id=modal_id move_from=current.id readthrough=readthrough refresh=True class="" %} +{% join "partially_read" uuid as modal_id %} +{% include 'snippets/reading_modals/partially_read_modal.html' with book=active_shelf.book id=modal_id move_from=current.id readthrough=readthrough refresh=True class="" %} + {% endwith %} {% endblock %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button.html b/bookwyrm/templates/snippets/shelve_button/shelve_button.html index 04dc4e4b..6944db6a 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button.html @@ -29,6 +29,9 @@ {% join "finish_reading" uuid as modal_id %} {% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %} +{% join "partially_read" uuid as modal_id %} +{% include 'snippets/reading_modals/partially_read_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %} + {% join "progress_update" uuid as modal_id %} {% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html b/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html index 1fa26a88..23e5f4a4 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html @@ -26,6 +26,13 @@ {% join "finish_reading" button_uuid as modal_id %} {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} + {% elif shelf.identifier == 'partially-read' %} + + {% trans "Partially read" as button_text %} + {% url 'reading-status' 'stop' book.id as fallback_url %} + {% join "partially_read" button_uuid as modal_id %} + {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} + {% elif shelf.identifier == 'to-read' %} {% trans "Want to read" as button_text %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html b/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html index 04f4bdc2..0a711add 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html @@ -33,6 +33,13 @@ {% join "finish_reading" button_uuid as modal_id %} {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} + {% elif shelf.identifier == 'partially-read' %} + + {% trans "Stop reading" as button_text %} + {% url 'reading-status' 'stop' book.id as fallback_url %} + {% join "partially_read" button_uuid as modal_id %} + {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} + {% elif shelf.identifier == 'to-read' %} {% trans "Want to read" as button_text %} diff --git a/bookwyrm/templates/snippets/translated_shelf_name.html b/bookwyrm/templates/snippets/translated_shelf_name.html index 4da47e37..dc1c579b 100644 --- a/bookwyrm/templates/snippets/translated_shelf_name.html +++ b/bookwyrm/templates/snippets/translated_shelf_name.html @@ -7,6 +7,8 @@ {% trans "Currently Reading" %} {% elif shelf.identifier == 'read' %} {% trans "Read" %} +{% elif shelf.identifier == 'partially-read' %} + {% trans "Partially Read" %} {% else %} {{ shelf.name }} {% endif %} diff --git a/bookwyrm/templates/user/user.html b/bookwyrm/templates/user/user.html index ccc4a44e..8d7fd31a 100755 --- a/bookwyrm/templates/user/user.html +++ b/bookwyrm/templates/user/user.html @@ -33,8 +33,9 @@ {% if shelf.name == 'To Read' %}{% trans "To Read" %} {% elif shelf.name == 'Currently Reading' %}{% trans "Currently Reading" %} {% elif shelf.name == 'Read' %}{% trans "Read" %} + {% elif shelf.name == 'Partially Read' %}{% trans "Partially Read" %} {% else %}{{ shelf.name }}{% endif %} - {% if shelf.size > 3 %}({% blocktrans with size=shelf.size %}View all {{ size }}{% endblocktrans %}){% endif %} + {% if shelf.size > 4 %}({% blocktrans with size=shelf.size %}View all {{ size }}{% endblocktrans %}){% endif %}
{% for book in shelf.books %} diff --git a/bookwyrm/tests/models/test_user_model.py b/bookwyrm/tests/models/test_user_model.py index aa62dce3..8d343963 100644 --- a/bookwyrm/tests/models/test_user_model.py +++ b/bookwyrm/tests/models/test_user_model.py @@ -58,10 +58,12 @@ class User(TestCase): self.assertTrue("To Read" in names) self.assertTrue("Currently Reading" in names) self.assertTrue("Read" in names) + self.assertTrue("Partially Read" in names) ids = [s.identifier for s in shelves] self.assertTrue("to-read" in ids) self.assertTrue("reading" in ids) self.assertTrue("read" in ids) + self.assertTrue("partially-read" in ids) def test_activitypub_serialize(self): activity = self.user.to_activity() diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 79d868c9..670610bd 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -543,7 +543,7 @@ urlpatterns = [ name="reading-status-update", ), re_path( - r"^reading-status/(?Pwant|start|finish)/(?P\d+)/?$", + r"^reading-status/(?Pwant|start|finish|stop)/(?P\d+)/?$", views.ReadingStatus.as_view(), name="reading-status", ), diff --git a/bookwyrm/views/reading.py b/bookwyrm/views/reading.py index 2cd05202..b80bc50d 100644 --- a/bookwyrm/views/reading.py +++ b/bookwyrm/views/reading.py @@ -29,6 +29,7 @@ class ReadingStatus(View): "want": "want.html", "start": "start.html", "finish": "finish.html", + "stop": "stop.html", }.get(status) if not template: return HttpResponseNotFound() @@ -41,6 +42,7 @@ class ReadingStatus(View): "want": models.Shelf.TO_READ, "start": models.Shelf.READING, "finish": models.Shelf.READ_FINISHED, + "stop": models.Shelf.PARTIALLY_READ, }.get(status) if not identifier: return HttpResponseBadRequest() From bc89dd704127e5c289c3576e87f6e8d86b75591b Mon Sep 17 00:00:00 2001 From: Thomas Versteeg Date: Sat, 12 Feb 2022 11:19:00 +0100 Subject: [PATCH 02/15] Change shelf Finished label When the shelf is read the label is 'Finished', otherwise it's 'Until'. --- bookwyrm/templates/shelf/shelf.html | 4 ++-- .../snippets/reading_modals/partially_read_modal.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bookwyrm/templates/shelf/shelf.html b/bookwyrm/templates/shelf/shelf.html index 67faf0a4..2a980e15 100644 --- a/bookwyrm/templates/shelf/shelf.html +++ b/bookwyrm/templates/shelf/shelf.html @@ -151,7 +151,7 @@ {% if is_self %} {% trans "Shelved" as text %}{% include 'snippets/table-sort-header.html' with field="shelved_date" sort=sort text=text %} {% trans "Started" as text %}{% include 'snippets/table-sort-header.html' with field="start_date" sort=sort text=text %} - {% trans "Finished" as text %}{% include 'snippets/table-sort-header.html' with field="finish_date" sort=sort text=text %} + {% if shelf.identifier == 'read' %}{% trans "Finished" as text %}{% else %}{% trans "Until" as text %}{% endif %}{% include 'snippets/table-sort-header.html' with field="finish_date" sort=sort text=text %} {% endif %} {% trans "Rating" as text %}{% include 'snippets/table-sort-header.html' with field="rating" sort=sort text=text %} {% endif %} @@ -181,7 +181,7 @@ {{ book.start_date|naturalday|default_if_none:""}} - + {{ book.finish_date|naturalday|default_if_none:""}} {% endif %} diff --git a/bookwyrm/templates/snippets/reading_modals/partially_read_modal.html b/bookwyrm/templates/snippets/reading_modals/partially_read_modal.html index 60c39c40..2260f8c1 100644 --- a/bookwyrm/templates/snippets/reading_modals/partially_read_modal.html +++ b/bookwyrm/templates/snippets/reading_modals/partially_read_modal.html @@ -28,10 +28,10 @@ Partially Read "{{ book_title }}"
-
From c88b34814f2530b5d14197c89743a00a31cebfb0 Mon Sep 17 00:00:00 2001 From: Thomas Versteeg Date: Sat, 12 Feb 2022 19:44:06 +0100 Subject: [PATCH 03/15] Rename 'Partially Read' to 'Stopped Reading' --- .../migrations/0134_alter_partially_read.py | 29 --------- .../migrations/0134_alter_stopped_reading.py | 59 +++++++++++++++++++ bookwyrm/models/shelf.py | 4 +- bookwyrm/models/status.py | 2 +- bookwyrm/models/user.py | 4 +- .../templates/get_started/book_preview.html | 2 +- bookwyrm/templates/shelf/shelf.html | 6 +- ...ead_modal.html => stop_reading_modal.html} | 6 +- .../templates/snippets/shelf_selector.html | 10 ++-- .../snippets/shelve_button/shelve_button.html | 4 +- .../shelve_button_dropdown_options.html | 6 +- .../shelve_button/shelve_button_options.html | 4 +- .../snippets/translated_shelf_name.html | 4 +- bookwyrm/templates/user/user.html | 2 +- bookwyrm/templatetags/shelf_tags.py | 29 +++++---- bookwyrm/tests/models/test_user_model.py | 4 +- bookwyrm/views/reading.py | 2 +- 17 files changed, 105 insertions(+), 72 deletions(-) delete mode 100644 bookwyrm/migrations/0134_alter_partially_read.py create mode 100644 bookwyrm/migrations/0134_alter_stopped_reading.py rename bookwyrm/templates/snippets/reading_modals/{partially_read_modal.html => stop_reading_modal.html} (85%) diff --git a/bookwyrm/migrations/0134_alter_partially_read.py b/bookwyrm/migrations/0134_alter_partially_read.py deleted file mode 100644 index 85e9ed9f..00000000 --- a/bookwyrm/migrations/0134_alter_partially_read.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 3.2.11 on 2022-02-11 13:19 - -import bookwyrm.models.fields -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('bookwyrm', '0133_alter_listitem_notes'), - ] - - operations = [ - migrations.AlterField( - model_name='comment', - name='reading_status', - field=bookwyrm.models.fields.CharField(blank=True, choices=[('to-read', 'To-Read'), ('reading', 'Reading'), ('read', 'Read'), ('partially-read', 'Partially-Read')], max_length=255, null=True), - ), - migrations.AlterField( - model_name='quotation', - name='reading_status', - field=bookwyrm.models.fields.CharField(blank=True, choices=[('to-read', 'To-Read'), ('reading', 'Reading'), ('read', 'Read'), ('partially-read', 'Partially-Read')], max_length=255, null=True), - ), - migrations.AlterField( - model_name='review', - name='reading_status', - field=bookwyrm.models.fields.CharField(blank=True, choices=[('to-read', 'To-Read'), ('reading', 'Reading'), ('read', 'Read'), ('partially-read', 'Partially-Read')], max_length=255, null=True), - ), - ] diff --git a/bookwyrm/migrations/0134_alter_stopped_reading.py b/bookwyrm/migrations/0134_alter_stopped_reading.py new file mode 100644 index 00000000..c0c2c652 --- /dev/null +++ b/bookwyrm/migrations/0134_alter_stopped_reading.py @@ -0,0 +1,59 @@ +# Generated by Django 3.2.11 on 2022-02-11 13:19 + +import bookwyrm.models.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("bookwyrm", "0133_alter_listitem_notes"), + ] + + operations = [ + migrations.AlterField( + model_name="comment", + name="reading_status", + field=bookwyrm.models.fields.CharField( + blank=True, + choices=[ + ("to-read", "To-Read"), + ("reading", "Reading"), + ("read", "Read"), + ("stopped-reading", "Stopped-Reading"), + ], + max_length=255, + null=True, + ), + ), + migrations.AlterField( + model_name="quotation", + name="reading_status", + field=bookwyrm.models.fields.CharField( + blank=True, + choices=[ + ("to-read", "To-Read"), + ("reading", "Reading"), + ("read", "Read"), + ("stopped-reading", "Stopped-Reading"), + ], + max_length=255, + null=True, + ), + ), + migrations.AlterField( + model_name="review", + name="reading_status", + field=bookwyrm.models.fields.CharField( + blank=True, + choices=[ + ("to-read", "To-Read"), + ("reading", "Reading"), + ("read", "Read"), + ("stopped-reading", "Stopped-Reading"), + ], + max_length=255, + null=True, + ), + ), + ] diff --git a/bookwyrm/models/shelf.py b/bookwyrm/models/shelf.py index 4c57eb96..14bb45c3 100644 --- a/bookwyrm/models/shelf.py +++ b/bookwyrm/models/shelf.py @@ -17,9 +17,9 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel): TO_READ = "to-read" READING = "reading" READ_FINISHED = "read" - PARTIALLY_READ = "partially-read" + STOPPED_READING = "stopped-reading" - READ_STATUS_IDENTIFIERS = (TO_READ, READING, READ_FINISHED, PARTIALLY_READ) + READ_STATUS_IDENTIFIERS = (TO_READ, READING, READ_FINISHED, STOPPED_READING) name = fields.CharField(max_length=100) identifier = models.CharField(max_length=100) diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index 99756df5..66fd76aa 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -265,7 +265,7 @@ class GeneratedNote(Status): ReadingStatusChoices = models.TextChoices( - "ReadingStatusChoices", ["to-read", "reading", "read", "partially-read"] + "ReadingStatusChoices", ["to-read", "reading", "read", "stopped-reading"] ) diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index 223bad0f..157b5f88 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -373,8 +373,8 @@ class User(OrderedCollectionPageMixin, AbstractUser): "identifier": "read", }, { - "name": "Partially Read", - "identifier": "partially-read", + "name": "Stopped Reading", + "identifier": "stopped-reading", }, ] diff --git a/bookwyrm/templates/get_started/book_preview.html b/bookwyrm/templates/get_started/book_preview.html index 51a5a4e6..9cfb56b0 100644 --- a/bookwyrm/templates/get_started/book_preview.html +++ b/bookwyrm/templates/get_started/book_preview.html @@ -10,7 +10,7 @@ {% if shelf.identifier == 'to-read' %}{% trans "To Read" %} {% elif shelf.identifier == 'reading' %}{% trans "Currently Reading" %} {% elif shelf.identifier == 'read' %}{% trans "Read" %} - {% elif shelf.identifier == 'partially-read' %}{% trans "Partially Read" %} + {% elif shelf.identifier == 'stopped-reading' %}{% trans "Stopped Reading" %} {% else %}{{ shelf.name }}{% endif %} {% endfor %} diff --git a/bookwyrm/templates/shelf/shelf.html b/bookwyrm/templates/shelf/shelf.html index 2a980e15..b36dc01c 100644 --- a/bookwyrm/templates/shelf/shelf.html +++ b/bookwyrm/templates/shelf/shelf.html @@ -86,7 +86,7 @@ {% if shelf.identifier == 'to-read' %}{% trans "To Read" %} {% elif shelf.identifier == 'reading' %}{% trans "Currently Reading" %} {% elif shelf.identifier == 'read' %}{% trans "Read" %} - {% elif shelf.identifier == 'partially-read' %}{% trans "Partially Read" %} + {% elif shelf.identifier == 'stopped-reading' %}{% trans "Stopped Reading" %} {% else %}{{ shelf.name }}{% endif %} {% include 'snippets/privacy-icons.html' with item=shelf %} @@ -151,7 +151,7 @@ {% if is_self %} {% trans "Shelved" as text %}{% include 'snippets/table-sort-header.html' with field="shelved_date" sort=sort text=text %} {% trans "Started" as text %}{% include 'snippets/table-sort-header.html' with field="start_date" sort=sort text=text %} - {% if shelf.identifier == 'read' %}{% trans "Finished" as text %}{% else %}{% trans "Until" as text %}{% endif %}{% include 'snippets/table-sort-header.html' with field="finish_date" sort=sort text=text %} + {% if shelf.identifier == 'read' %}{% trans "Finished" as text %}{% else %}{% trans "Until" as text %}{% endif %}{% include 'snippets/table-sort-header.html' with field="finish_date" sort=sort text=text %} {% endif %} {% trans "Rating" as text %}{% include 'snippets/table-sort-header.html' with field="rating" sort=sort text=text %} {% endif %} @@ -181,7 +181,7 @@ {{ book.start_date|naturalday|default_if_none:""}} - + {{ book.finish_date|naturalday|default_if_none:""}} {% endif %} diff --git a/bookwyrm/templates/snippets/reading_modals/partially_read_modal.html b/bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html similarity index 85% rename from bookwyrm/templates/snippets/reading_modals/partially_read_modal.html rename to bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html index 2260f8c1..163a3415 100644 --- a/bookwyrm/templates/snippets/reading_modals/partially_read_modal.html +++ b/bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html @@ -4,12 +4,12 @@ {% block modal-title %} {% blocktrans trimmed with book_title=book|book_title %} -Partially Read "{{ book_title }}" +Stop Reading "{{ book_title }}" {% endblocktrans %} {% endblock %} {% block modal-form-open %} - + {% csrf_token %} @@ -38,5 +38,5 @@ Partially Read "{{ book_title }}" {% endblock %} {% block form %} -{% include "snippets/reading_modals/form.html" with optional=True type="partially_read_model" %} +{% include "snippets/reading_modals/form.html" with optional=True type="stop_modal" %} {% endblock %} diff --git a/bookwyrm/templates/snippets/shelf_selector.html b/bookwyrm/templates/snippets/shelf_selector.html index 7589ffc6..ef245cec 100644 --- a/bookwyrm/templates/snippets/shelf_selector.html +++ b/bookwyrm/templates/snippets/shelf_selector.html @@ -49,11 +49,11 @@ {% join "finish_reading" uuid as modal_id %} {% include 'snippets/shelve_button/modal_button.html' with class=button_class fallback_url=fallback_url %} -{% elif shelf.identifier == 'partially-read' %} +{% elif shelf.identifier == 'stopped-reading' %} -{% trans "Partially read" as button_text %} +{% trans "Stopped reading" as button_text %} {% url 'reading-status' 'stop' book.id as fallback_url %} -{% join "partially_read" uuid as modal_id %} +{% join "stop_reading" uuid as modal_id %} {% include 'snippets/shelve_button/modal_button.html' with class=button_class fallback_url=fallback_url %} {% elif shelf.identifier == 'to-read' %} @@ -104,8 +104,8 @@ {% join "finish_reading" uuid as modal_id %} {% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book id=modal_id move_from=current.id readthrough=readthrough refresh=True class="" %} -{% join "partially_read" uuid as modal_id %} -{% include 'snippets/reading_modals/partially_read_modal.html' with book=active_shelf.book id=modal_id move_from=current.id readthrough=readthrough refresh=True class="" %} +{% join "stop_reading" uuid as modal_id %} +{% include 'snippets/reading_modals/stop_reading_modal.html' with book=active_shelf.book id=modal_id move_from=current.id readthrough=readthrough refresh=True class="" %} {% endwith %} {% endblock %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button.html b/bookwyrm/templates/snippets/shelve_button/shelve_button.html index 6944db6a..010bff05 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button.html @@ -29,8 +29,8 @@ {% join "finish_reading" uuid as modal_id %} {% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %} -{% join "partially_read" uuid as modal_id %} -{% include 'snippets/reading_modals/partially_read_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %} +{% join "stop_reading" uuid as modal_id %} +{% include 'snippets/reading_modals/stop_reading_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %} {% join "progress_update" uuid as modal_id %} {% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html b/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html index 23e5f4a4..236c0797 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button_dropdown_options.html @@ -26,11 +26,11 @@ {% join "finish_reading" button_uuid as modal_id %} {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} - {% elif shelf.identifier == 'partially-read' %} + {% elif shelf.identifier == 'stopped-reading' %} - {% trans "Partially read" as button_text %} + {% trans "Stop reading" as button_text %} {% url 'reading-status' 'stop' book.id as fallback_url %} - {% join "partially_read" button_uuid as modal_id %} + {% join "stop_reading" button_uuid as modal_id %} {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} {% elif shelf.identifier == 'to-read' %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html b/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html index 0a711add..fb7ee452 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button_options.html @@ -33,11 +33,11 @@ {% join "finish_reading" button_uuid as modal_id %} {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} - {% elif shelf.identifier == 'partially-read' %} + {% elif shelf.identifier == 'stopped-reading' %} {% trans "Stop reading" as button_text %} {% url 'reading-status' 'stop' book.id as fallback_url %} - {% join "partially_read" button_uuid as modal_id %} + {% join "stop_reading" button_uuid as modal_id %} {% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %} {% elif shelf.identifier == 'to-read' %} diff --git a/bookwyrm/templates/snippets/translated_shelf_name.html b/bookwyrm/templates/snippets/translated_shelf_name.html index dc1c579b..763ca854 100644 --- a/bookwyrm/templates/snippets/translated_shelf_name.html +++ b/bookwyrm/templates/snippets/translated_shelf_name.html @@ -7,8 +7,8 @@ {% trans "Currently Reading" %} {% elif shelf.identifier == 'read' %} {% trans "Read" %} -{% elif shelf.identifier == 'partially-read' %} - {% trans "Partially Read" %} +{% elif shelf.identifier == 'stopped-reading' %} + {% trans "Stopped Reading" %} {% else %} {{ shelf.name }} {% endif %} diff --git a/bookwyrm/templates/user/user.html b/bookwyrm/templates/user/user.html index 8d7fd31a..af85159f 100755 --- a/bookwyrm/templates/user/user.html +++ b/bookwyrm/templates/user/user.html @@ -33,7 +33,7 @@ {% if shelf.name == 'To Read' %}{% trans "To Read" %} {% elif shelf.name == 'Currently Reading' %}{% trans "Currently Reading" %} {% elif shelf.name == 'Read' %}{% trans "Read" %} - {% elif shelf.name == 'Partially Read' %}{% trans "Partially Read" %} + {% elif shelf.name == 'Stopped Reading' %}{% trans "Stopped Reading" %} {% else %}{{ shelf.name }}{% endif %} {% if shelf.size > 4 %}({% blocktrans with size=shelf.size %}View all {{ size }}{% endblocktrans %}){% endif %} diff --git a/bookwyrm/templatetags/shelf_tags.py b/bookwyrm/templatetags/shelf_tags.py index 6c4f59c3..7aef638f 100644 --- a/bookwyrm/templatetags/shelf_tags.py +++ b/bookwyrm/templatetags/shelf_tags.py @@ -36,19 +36,22 @@ def get_next_shelf(current_shelf): def active_shelf(context, book): """check what shelf a user has a book on, if any""" user = context["request"].user - return cache.get_or_set( - f"active_shelf-{user.id}-{book.id}", - lambda u, b: ( - models.ShelfBook.objects.filter( - shelf__user=u, - book__parent_work__editions=b, - ).first() - or False - ), - user, - book, - timeout=15552000, - ) or {"book": book} + return ( + cache.get_or_set( + f"active_shelf-{user.id}-{book.id}", + lambda u, b: ( + models.ShelfBook.objects.filter( + shelf__user=u, + book__parent_work__editions=b, + ).first() + or False + ), + user, + book, + timeout=15552000, + ) + or {"book": book} + ) @register.simple_tag(takes_context=False) diff --git a/bookwyrm/tests/models/test_user_model.py b/bookwyrm/tests/models/test_user_model.py index 8d343963..e4395e2f 100644 --- a/bookwyrm/tests/models/test_user_model.py +++ b/bookwyrm/tests/models/test_user_model.py @@ -58,12 +58,12 @@ class User(TestCase): self.assertTrue("To Read" in names) self.assertTrue("Currently Reading" in names) self.assertTrue("Read" in names) - self.assertTrue("Partially Read" in names) + self.assertTrue("Stopped Reading" in names) ids = [s.identifier for s in shelves] self.assertTrue("to-read" in ids) self.assertTrue("reading" in ids) self.assertTrue("read" in ids) - self.assertTrue("partially-read" in ids) + self.assertTrue("stopped-reading" in ids) def test_activitypub_serialize(self): activity = self.user.to_activity() diff --git a/bookwyrm/views/reading.py b/bookwyrm/views/reading.py index b80bc50d..3cd153d2 100644 --- a/bookwyrm/views/reading.py +++ b/bookwyrm/views/reading.py @@ -42,7 +42,7 @@ class ReadingStatus(View): "want": models.Shelf.TO_READ, "start": models.Shelf.READING, "finish": models.Shelf.READ_FINISHED, - "stop": models.Shelf.PARTIALLY_READ, + "stop": models.Shelf.STOPPED_READING, }.get(status) if not identifier: return HttpResponseBadRequest() From d63e5ab2d2219aa18c624750b813d60cf425b391 Mon Sep 17 00:00:00 2001 From: Thomas Versteeg Date: Mon, 14 Feb 2022 18:12:08 +0100 Subject: [PATCH 04/15] Fix tests --- .../reading_modals/stop_reading_modal.html | 4 +-- bookwyrm/templatetags/shelf_tags.py | 29 +++++++++---------- bookwyrm/tests/models/test_user_model.py | 2 +- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html b/bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html index 163a3415..93a36da5 100644 --- a/bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html +++ b/bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html @@ -20,10 +20,10 @@ Stop Reading "{{ book_title }}"
-
diff --git a/bookwyrm/templatetags/shelf_tags.py b/bookwyrm/templatetags/shelf_tags.py index 7aef638f..6c4f59c3 100644 --- a/bookwyrm/templatetags/shelf_tags.py +++ b/bookwyrm/templatetags/shelf_tags.py @@ -36,22 +36,19 @@ def get_next_shelf(current_shelf): def active_shelf(context, book): """check what shelf a user has a book on, if any""" user = context["request"].user - return ( - cache.get_or_set( - f"active_shelf-{user.id}-{book.id}", - lambda u, b: ( - models.ShelfBook.objects.filter( - shelf__user=u, - book__parent_work__editions=b, - ).first() - or False - ), - user, - book, - timeout=15552000, - ) - or {"book": book} - ) + return cache.get_or_set( + f"active_shelf-{user.id}-{book.id}", + lambda u, b: ( + models.ShelfBook.objects.filter( + shelf__user=u, + book__parent_work__editions=b, + ).first() + or False + ), + user, + book, + timeout=15552000, + ) or {"book": book} @register.simple_tag(takes_context=False) diff --git a/bookwyrm/tests/models/test_user_model.py b/bookwyrm/tests/models/test_user_model.py index e4395e2f..471099ab 100644 --- a/bookwyrm/tests/models/test_user_model.py +++ b/bookwyrm/tests/models/test_user_model.py @@ -53,7 +53,7 @@ class User(TestCase): def test_user_shelves(self): shelves = models.Shelf.objects.filter(user=self.user).all() - self.assertEqual(len(shelves), 3) + self.assertEqual(len(shelves), 4) names = [s.name for s in shelves] self.assertTrue("To Read" in names) self.assertTrue("Currently Reading" in names) From 5eb113af6b30c71324cafea895bcf1dd5ab7eac0 Mon Sep 17 00:00:00 2001 From: Thomas Versteeg Date: Fri, 25 Feb 2022 22:03:49 +0100 Subject: [PATCH 05/15] Create merge migration --- bookwyrm/migrations/0142_merge_20220225_2103.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 bookwyrm/migrations/0142_merge_20220225_2103.py diff --git a/bookwyrm/migrations/0142_merge_20220225_2103.py b/bookwyrm/migrations/0142_merge_20220225_2103.py new file mode 100644 index 00000000..8053d8f9 --- /dev/null +++ b/bookwyrm/migrations/0142_merge_20220225_2103.py @@ -0,0 +1,14 @@ +# Generated by Django 3.2.12 on 2022-02-25 21:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0134_alter_stopped_reading'), + ('bookwyrm', '0141_alter_report_status'), + ] + + operations = [ + ] From 8deee2220e05a0a5fc238780a879cca2b90ceb49 Mon Sep 17 00:00:00 2001 From: Thomas Versteeg Date: Fri, 25 Feb 2022 22:38:58 +0100 Subject: [PATCH 06/15] Fix stopped reading status model in non-javascript environment --- bookwyrm/migrations/0142_merge_20220225_2103.py | 7 +++---- bookwyrm/templates/reading_progress/stop.html | 14 ++++++++++++++ .../reading_modals/stop_reading_modal.html | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 bookwyrm/templates/reading_progress/stop.html diff --git a/bookwyrm/migrations/0142_merge_20220225_2103.py b/bookwyrm/migrations/0142_merge_20220225_2103.py index 8053d8f9..62f8dcfe 100644 --- a/bookwyrm/migrations/0142_merge_20220225_2103.py +++ b/bookwyrm/migrations/0142_merge_20220225_2103.py @@ -6,9 +6,8 @@ from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ('bookwyrm', '0134_alter_stopped_reading'), - ('bookwyrm', '0141_alter_report_status'), + ("bookwyrm", "0134_alter_stopped_reading"), + ("bookwyrm", "0141_alter_report_status"), ] - operations = [ - ] + operations = [] diff --git a/bookwyrm/templates/reading_progress/stop.html b/bookwyrm/templates/reading_progress/stop.html new file mode 100644 index 00000000..5811c09b --- /dev/null +++ b/bookwyrm/templates/reading_progress/stop.html @@ -0,0 +1,14 @@ +{% extends 'layout.html' %} +{% load i18n %} + +{% block title %} +{% blocktrans trimmed with book_title=book.title %} +Stop Reading "{{ book_title }}" +{% endblocktrans %} +{% endblock %} + +{% block content %} + +{% include "snippets/reading_modals/stop_reading_modal.html" with book=book active=True static=True %} + +{% endblock %} diff --git a/bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html b/bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html index 93a36da5..80fb2d5b 100644 --- a/bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html +++ b/bookwyrm/templates/snippets/reading_modals/stop_reading_modal.html @@ -31,7 +31,7 @@ Stop Reading "{{ book_title }}" - +
From b5119284006ecb0ec02200191940a0a0650afcd1 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 25 Feb 2022 18:08:30 -0800 Subject: [PATCH 07/15] Create 0134_alter_stopped_reading.py --- .../migrations/0134_alter_stopped_reading.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bookwyrm/migrations/0134_alter_stopped_reading.py b/bookwyrm/migrations/0134_alter_stopped_reading.py index c0c2c652..15bd75b2 100644 --- a/bookwyrm/migrations/0134_alter_stopped_reading.py +++ b/bookwyrm/migrations/0134_alter_stopped_reading.py @@ -3,6 +3,22 @@ import bookwyrm.models.fields from django.db import migrations +def add_shelves(apps, schema_editor): + """add any superusers to the "admin" group""" + + db_alias = schema_editor.connection.alias + shelf_model = apps.get_model("bookwyrm", "Shelf") + + users = apps.get_model("bookwyrm", "User") + local_users = users.objects.using(db_alias).filter(local=True) + for user in local_users: + shelf_model.using(db_alias)( + name="Stopped reading", + identifier=Shelf.STOPPED_READING, + user=user, + editable=False, + ).save(broadcast=False) + class Migration(migrations.Migration): @@ -56,4 +72,5 @@ class Migration(migrations.Migration): null=True, ), ), + migrations.RunPython(add_shelves, reverse_code=migrations.RunPython.noop), ] From a5571c65bc127a8767e288fe2f522eb8f2a479bc Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 25 Feb 2022 18:25:41 -0800 Subject: [PATCH 08/15] Update 0134_alter_stopped_reading.py --- bookwyrm/migrations/0134_alter_stopped_reading.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bookwyrm/migrations/0134_alter_stopped_reading.py b/bookwyrm/migrations/0134_alter_stopped_reading.py index 15bd75b2..13c02e99 100644 --- a/bookwyrm/migrations/0134_alter_stopped_reading.py +++ b/bookwyrm/migrations/0134_alter_stopped_reading.py @@ -3,6 +3,7 @@ import bookwyrm.models.fields from django.db import migrations + def add_shelves(apps, schema_editor): """add any superusers to the "admin" group""" From 1e3f9246d64abb3d6950c4bd0149b2182d2307cf Mon Sep 17 00:00:00 2001 From: Thomas Versteeg Date: Mon, 28 Feb 2022 20:56:59 +0100 Subject: [PATCH 09/15] Produce a proper status --- bookwyrm/views/helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bookwyrm/views/helpers.py b/bookwyrm/views/helpers.py index 74d867b6..b0ee713e 100644 --- a/bookwyrm/views/helpers.py +++ b/bookwyrm/views/helpers.py @@ -137,6 +137,7 @@ def handle_reading_status(user, shelf, book, privacy): "to-read": "wants to read", "reading": "started reading", "read": "finished reading", + "stopped-reading": "stopped reading", }[shelf.identifier] except KeyError: # it's a non-standard shelf, don't worry about it From 5d8404f79728cae1a0d59f4b6f773d6445a2507a Mon Sep 17 00:00:00 2001 From: Thomas Versteeg Date: Sat, 12 Mar 2022 11:45:09 +0100 Subject: [PATCH 10/15] Add merge migration --- bookwyrm/migrations/0145_merge_20220312_1040.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 bookwyrm/migrations/0145_merge_20220312_1040.py diff --git a/bookwyrm/migrations/0145_merge_20220312_1040.py b/bookwyrm/migrations/0145_merge_20220312_1040.py new file mode 100644 index 00000000..3fa131c4 --- /dev/null +++ b/bookwyrm/migrations/0145_merge_20220312_1040.py @@ -0,0 +1,14 @@ +# Generated by Django 3.2.12 on 2022-03-12 10:40 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0142_merge_20220225_2103'), + ('bookwyrm', '0144_alter_announcement_display_type'), + ] + + operations = [ + ] From b3f03164cc3330cdf170e216021a5a094053c4ce Mon Sep 17 00:00:00 2001 From: Thomas Versteeg Date: Tue, 15 Mar 2022 09:28:33 +0100 Subject: [PATCH 11/15] Apply black --- bookwyrm/migrations/0145_merge_20220312_1040.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bookwyrm/migrations/0145_merge_20220312_1040.py b/bookwyrm/migrations/0145_merge_20220312_1040.py index 3fa131c4..8e6c75ac 100644 --- a/bookwyrm/migrations/0145_merge_20220312_1040.py +++ b/bookwyrm/migrations/0145_merge_20220312_1040.py @@ -6,9 +6,8 @@ from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ('bookwyrm', '0142_merge_20220225_2103'), - ('bookwyrm', '0144_alter_announcement_display_type'), + ("bookwyrm", "0142_merge_20220225_2103"), + ("bookwyrm", "0144_alter_announcement_display_type"), ] - operations = [ - ] + operations = [] From 819458e82a9d2c276fdf770836131a4b345cdb8a Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 16 Mar 2022 13:53:54 -0700 Subject: [PATCH 12/15] Improves error reporting on activitypub parser --- bookwyrm/activitypub/base_activity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/activitypub/base_activity.py b/bookwyrm/activitypub/base_activity.py index 6bee25f6..92f0c99a 100644 --- a/bookwyrm/activitypub/base_activity.py +++ b/bookwyrm/activitypub/base_activity.py @@ -65,7 +65,7 @@ class ActivityObject: try: value = kwargs[field.name] if value in (None, MISSING, {}): - raise KeyError() + raise KeyError("Missing required field", field.name) try: is_subclass = issubclass(field.type, ActivityObject) except TypeError: From 159b73d860d3c1e0c7a6bbd636eb232c5ff04bb4 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 16 Mar 2022 13:54:25 -0700 Subject: [PATCH 13/15] Fixes errors in migration --- bookwyrm/migrations/0134_alter_stopped_reading.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bookwyrm/migrations/0134_alter_stopped_reading.py b/bookwyrm/migrations/0134_alter_stopped_reading.py index 13c02e99..ba49f612 100644 --- a/bookwyrm/migrations/0134_alter_stopped_reading.py +++ b/bookwyrm/migrations/0134_alter_stopped_reading.py @@ -1,7 +1,8 @@ # Generated by Django 3.2.11 on 2022-02-11 13:19 -import bookwyrm.models.fields from django.db import migrations +import bookwyrm.models.fields +from bookwyrm.models import Shelf def add_shelves(apps, schema_editor): @@ -13,12 +14,14 @@ def add_shelves(apps, schema_editor): users = apps.get_model("bookwyrm", "User") local_users = users.objects.using(db_alias).filter(local=True) for user in local_users: - shelf_model.using(db_alias)( + remote_id = f"{user.remote_id}/books/stopped" + shelf_model.objects.using(db_alias).create( name="Stopped reading", identifier=Shelf.STOPPED_READING, user=user, editable=False, - ).save(broadcast=False) + remote_id=remote_id, + ) class Migration(migrations.Migration): From 108981a226719a041056a8282c49d57be3c1a761 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 16 Mar 2022 16:35:03 -0700 Subject: [PATCH 14/15] Creates fresh migration and removes merges --- bookwyrm/migrations/0142_merge_20220225_2103.py | 13 ------------- bookwyrm/migrations/0145_merge_20220312_1040.py | 13 ------------- ...topped_reading.py => 0146_auto_20220316_2320.py} | 6 +++--- 3 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 bookwyrm/migrations/0142_merge_20220225_2103.py delete mode 100644 bookwyrm/migrations/0145_merge_20220312_1040.py rename bookwyrm/migrations/{0134_alter_stopped_reading.py => 0146_auto_20220316_2320.py} (95%) diff --git a/bookwyrm/migrations/0142_merge_20220225_2103.py b/bookwyrm/migrations/0142_merge_20220225_2103.py deleted file mode 100644 index 62f8dcfe..00000000 --- a/bookwyrm/migrations/0142_merge_20220225_2103.py +++ /dev/null @@ -1,13 +0,0 @@ -# Generated by Django 3.2.12 on 2022-02-25 21:03 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("bookwyrm", "0134_alter_stopped_reading"), - ("bookwyrm", "0141_alter_report_status"), - ] - - operations = [] diff --git a/bookwyrm/migrations/0145_merge_20220312_1040.py b/bookwyrm/migrations/0145_merge_20220312_1040.py deleted file mode 100644 index 8e6c75ac..00000000 --- a/bookwyrm/migrations/0145_merge_20220312_1040.py +++ /dev/null @@ -1,13 +0,0 @@ -# Generated by Django 3.2.12 on 2022-03-12 10:40 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("bookwyrm", "0142_merge_20220225_2103"), - ("bookwyrm", "0144_alter_announcement_display_type"), - ] - - operations = [] diff --git a/bookwyrm/migrations/0134_alter_stopped_reading.py b/bookwyrm/migrations/0146_auto_20220316_2320.py similarity index 95% rename from bookwyrm/migrations/0134_alter_stopped_reading.py rename to bookwyrm/migrations/0146_auto_20220316_2320.py index ba49f612..e50bf25e 100644 --- a/bookwyrm/migrations/0134_alter_stopped_reading.py +++ b/bookwyrm/migrations/0146_auto_20220316_2320.py @@ -1,7 +1,7 @@ -# Generated by Django 3.2.11 on 2022-02-11 13:19 +# Generated by Django 3.2.12 on 2022-03-16 23:20 -from django.db import migrations import bookwyrm.models.fields +from django.db import migrations from bookwyrm.models import Shelf @@ -27,7 +27,7 @@ def add_shelves(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ("bookwyrm", "0133_alter_listitem_notes"), + ("bookwyrm", "0145_sitesettings_version"), ] operations = [ From 71cbe611deb522f8320b9d3a900c6a9608e342fa Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 26 Mar 2022 13:07:27 -0700 Subject: [PATCH 15/15] Merge migration --- bookwyrm/migrations/0148_merge_20220326_2006.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 bookwyrm/migrations/0148_merge_20220326_2006.py diff --git a/bookwyrm/migrations/0148_merge_20220326_2006.py b/bookwyrm/migrations/0148_merge_20220326_2006.py new file mode 100644 index 00000000..97866276 --- /dev/null +++ b/bookwyrm/migrations/0148_merge_20220326_2006.py @@ -0,0 +1,13 @@ +# Generated by Django 3.2.12 on 2022-03-26 20:06 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("bookwyrm", "0146_auto_20220316_2320"), + ("bookwyrm", "0147_alter_user_preferred_language"), + ] + + operations = []