diff --git a/bookwyrm/forms/author.py b/bookwyrm/forms/author.py index 5b54a07b5..a3a759af7 100644 --- a/bookwyrm/forms/author.py +++ b/bookwyrm/forms/author.py @@ -15,6 +15,7 @@ class AuthorForm(CustomForm): "aliases", "bio", "wikipedia_link", + "wikidata", "website", "born", "died", @@ -32,6 +33,7 @@ class AuthorForm(CustomForm): "wikipedia_link": forms.TextInput( attrs={"aria-describedby": "desc_wikipedia_link"} ), + "wikidata": forms.TextInput(attrs={"aria-describedby": "desc_wikidata"}), "website": forms.TextInput(attrs={"aria-describedby": "desc_website"}), "born": forms.SelectDateWidget(attrs={"aria-describedby": "desc_born"}), "died": forms.SelectDateWidget(attrs={"aria-describedby": "desc_died"}), diff --git a/bookwyrm/templates/author/edit_author.html b/bookwyrm/templates/author/edit_author.html index 12ddc4d28..f3e908c9b 100644 --- a/bookwyrm/templates/author/edit_author.html +++ b/bookwyrm/templates/author/edit_author.html @@ -55,6 +55,8 @@

{{ form.wikipedia_link }}

+

{{ form.wikidata }}

+ {% include 'snippets/form_errors.html' with errors_list=form.wikipedia_link.errors id="desc_wikipedia_link" %}

{{ form.website }}

diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index 4c345832e..83500a54b 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -45,18 +45,22 @@ {% endif %} {% if book.series %} - + {% spaceless %} {% if book.authors.exists %} {% endif %} + {% if book.series_number %} + , # + {{ book.series_number }} + {% endif %} + {% endspaceless %} {% endif %}

{% endif %} diff --git a/bookwyrm/templates/snippets/book_series.html b/bookwyrm/templates/snippets/book_series.html new file mode 100644 index 000000000..fd1343604 --- /dev/null +++ b/bookwyrm/templates/snippets/book_series.html @@ -0,0 +1,3 @@ +{% if book.series %} +({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %}) +{% endif %} diff --git a/bookwyrm/templates/snippets/book_titleby.html b/bookwyrm/templates/snippets/book_titleby.html index dc42bf273..518d96389 100644 --- a/bookwyrm/templates/snippets/book_titleby.html +++ b/bookwyrm/templates/snippets/book_titleby.html @@ -9,12 +9,15 @@ {% if book.authors.exists %} {% blocktrans trimmed with path=book.local_path title=book|book_title %} -{{ title }} by +{{ title }} +by {% endblocktrans %} {% include 'snippets/authors.html' with book=book limit=3 %} {% else %} {{ book|book_title }} {% endif %} +{% include 'snippets/book_series.html' with book=book %} + {% endcache %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/comment.html b/bookwyrm/templates/snippets/status/headers/comment.html index e3e2ec40b..72bf5b255 100644 --- a/bookwyrm/templates/snippets/status/headers/comment.html +++ b/bookwyrm/templates/snippets/status/headers/comment.html @@ -17,4 +17,7 @@ commented on {{ book }} {% endblocktrans %} {% endif %} + +{% include 'snippets/book_series.html' with book=book %} + {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/quotation.html b/bookwyrm/templates/snippets/status/headers/quotation.html index 2cdd5a991..ce0ea5923 100644 --- a/bookwyrm/templates/snippets/status/headers/quotation.html +++ b/bookwyrm/templates/snippets/status/headers/quotation.html @@ -17,4 +17,7 @@ quoted {{ book }} {% endblocktrans %} {% endif %} + +{% include 'snippets/book_series.html' with book=book %} + {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/read.html b/bookwyrm/templates/snippets/status/headers/read.html index a59a3544e..5a237a836 100644 --- a/bookwyrm/templates/snippets/status/headers/read.html +++ b/bookwyrm/templates/snippets/status/headers/read.html @@ -19,4 +19,7 @@ finished reading {{ book }} {% endblocktrans %} {% endif %} + +{% include 'snippets/book_series.html' with book=book %} + {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/reading.html b/bookwyrm/templates/snippets/status/headers/reading.html index 886158f29..44c604620 100644 --- a/bookwyrm/templates/snippets/status/headers/reading.html +++ b/bookwyrm/templates/snippets/status/headers/reading.html @@ -19,4 +19,7 @@ started reading {{ book }} {% endblocktrans %} {% endif %} + +{% include 'snippets/book_series.html' with book=book %} + {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/review.html b/bookwyrm/templates/snippets/status/headers/review.html index a2168b948..95a6fc403 100644 --- a/bookwyrm/templates/snippets/status/headers/review.html +++ b/bookwyrm/templates/snippets/status/headers/review.html @@ -17,4 +17,7 @@ reviewed {{ book }} {% endblocktrans %} {% endif %} + +{% include 'snippets/book_series.html' with book=book %} + {% endwith %} diff --git a/bookwyrm/templates/snippets/status/headers/stopped_reading.html b/bookwyrm/templates/snippets/status/headers/stopped_reading.html index 3b6a314e1..09f2e4264 100644 --- a/bookwyrm/templates/snippets/status/headers/stopped_reading.html +++ b/bookwyrm/templates/snippets/status/headers/stopped_reading.html @@ -19,5 +19,8 @@ stopped reading {{ book }} {% endblocktrans %} {% endif %} + +{% include 'snippets/book_series.html' with book=book %} + {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/to_read.html b/bookwyrm/templates/snippets/status/headers/to_read.html index 2abdde17b..c775c33a7 100644 --- a/bookwyrm/templates/snippets/status/headers/to_read.html +++ b/bookwyrm/templates/snippets/status/headers/to_read.html @@ -19,4 +19,7 @@ wants to read {{ book }} {% endblocktrans %} {% endif %} + +{% include 'snippets/book_series.html' with book=book %} + {% endspaceless %} diff --git a/bookwyrm/tests/data/user_import.json b/bookwyrm/tests/data/user_import.json index 0318ddfeb..ffe2e7d9e 100644 --- a/bookwyrm/tests/data/user_import.json +++ b/bookwyrm/tests/data/user_import.json @@ -136,6 +136,7 @@ ], "bio": "

American political scientist and anthropologist

", "wikipediaLink": "https://en.wikipedia.org/wiki/James_C._Scott", + "wikidata": "Q3025403", "website": "", "@context": "https://www.w3.org/ns/activitystreams" } @@ -320,6 +321,7 @@ "aliases": [], "bio": "", "wikipediaLink": "", + "wikidata": "", "website": "", "@context": "https://www.w3.org/ns/activitystreams" } @@ -396,4 +398,4 @@ "https://your.domain.here/user/rat" ], "blocks": ["https://your.domain.here/user/badger"] -} \ No newline at end of file +} diff --git a/bookwyrm/views/books/editions.py b/bookwyrm/views/books/editions.py index 86f818d54..a3167fac4 100644 --- a/bookwyrm/views/books/editions.py +++ b/bookwyrm/views/books/editions.py @@ -3,6 +3,7 @@ from functools import reduce import operator from django.contrib.auth.decorators import login_required +from django.core.cache import cache as django_cache from django.core.paginator import Paginator from django.db import transaction from django.db.models import Q @@ -104,6 +105,13 @@ def switch_edition(request): readthrough.book = new_edition readthrough.save() + django_cache.delete_many( + [ + f"active_shelf-{request.user.id}-{book_id}" + for book_id in new_edition.parent_work.editions.values_list("id", flat=True) + ] + ) + reviews = models.Review.objects.filter( book__parent_work=new_edition.parent_work, user=request.user ) diff --git a/docker-compose.yml b/docker-compose.yml index 034cc2677..71a844ba2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: networks: - main volumes: - - ./nginx:/etc/nginx/conf.d:ro + - ./nginx:/etc/nginx/conf.d - static_volume:/app/static - media_volume:/app/images db: @@ -26,7 +26,7 @@ services: env_file: .env command: python manage.py runserver 0.0.0.0:8000 volumes: - - .:/app:ro + - .:/app - static_volume:/app/static - media_volume:/app/images depends_on: @@ -41,7 +41,7 @@ services: image: redis:7.2.1 command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes --port ${REDIS_ACTIVITY_PORT} volumes: - - ./redis.conf:/etc/redis/redis.conf:ro + - ./redis.conf:/etc/redis/redis.conf - redis_activity_data:/data env_file: .env networks: @@ -51,7 +51,7 @@ services: image: redis:7.2.1 command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} --appendonly yes --port ${REDIS_BROKER_PORT} volumes: - - ./redis.conf:/etc/redis/redis.conf:ro + - ./redis.conf:/etc/redis/redis.conf - redis_broker_data:/data env_file: .env networks: @@ -64,7 +64,7 @@ services: - main command: celery -A celerywyrm worker -l info -Q high_priority,medium_priority,low_priority,streams,images,suggested_users,email,connectors,lists,inbox,imports,import_triggered,broadcast,misc volumes: - - .:/app:ro + - .:/app - static_volume:/app/static - media_volume:/app/images depends_on: @@ -78,7 +78,7 @@ services: - main command: celery -A celerywyrm beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler volumes: - - .:/app:ro + - .:/app - static_volume:/app/static - media_volume:/app/images depends_on: @@ -89,7 +89,7 @@ services: command: celery -A celerywyrm flower --basic_auth=${FLOWER_USER}:${FLOWER_PASSWORD} --url_prefix=flower env_file: .env volumes: - - .:/app:ro + - .:/app - static_volume:/app/static networks: - main @@ -102,7 +102,7 @@ services: env_file: .env volumes: - /app/dev-tools/ - - .:/app:rw + - .:/app profiles: - tools volumes: