mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-22 01:21:07 +00:00
Merge branch 'main' into user-export
This commit is contained in:
commit
a770689245
15 changed files with 57 additions and 12 deletions
|
@ -15,6 +15,7 @@ class AuthorForm(CustomForm):
|
||||||
"aliases",
|
"aliases",
|
||||||
"bio",
|
"bio",
|
||||||
"wikipedia_link",
|
"wikipedia_link",
|
||||||
|
"wikidata",
|
||||||
"website",
|
"website",
|
||||||
"born",
|
"born",
|
||||||
"died",
|
"died",
|
||||||
|
@ -32,6 +33,7 @@ class AuthorForm(CustomForm):
|
||||||
"wikipedia_link": forms.TextInput(
|
"wikipedia_link": forms.TextInput(
|
||||||
attrs={"aria-describedby": "desc_wikipedia_link"}
|
attrs={"aria-describedby": "desc_wikipedia_link"}
|
||||||
),
|
),
|
||||||
|
"wikidata": forms.TextInput(attrs={"aria-describedby": "desc_wikidata"}),
|
||||||
"website": forms.TextInput(attrs={"aria-describedby": "desc_website"}),
|
"website": forms.TextInput(attrs={"aria-describedby": "desc_website"}),
|
||||||
"born": forms.SelectDateWidget(attrs={"aria-describedby": "desc_born"}),
|
"born": forms.SelectDateWidget(attrs={"aria-describedby": "desc_born"}),
|
||||||
"died": forms.SelectDateWidget(attrs={"aria-describedby": "desc_died"}),
|
"died": forms.SelectDateWidget(attrs={"aria-describedby": "desc_died"}),
|
||||||
|
|
|
@ -55,6 +55,8 @@
|
||||||
|
|
||||||
<p class="field"><label class="label" for="id_wikipedia_link">{% trans "Wikipedia link:" %}</label> {{ form.wikipedia_link }}</p>
|
<p class="field"><label class="label" for="id_wikipedia_link">{% trans "Wikipedia link:" %}</label> {{ form.wikipedia_link }}</p>
|
||||||
|
|
||||||
|
<p class="field"><label class="label" for="id_wikidata">{% trans "Wikidata:" %}</label> {{ form.wikidata }}</p>
|
||||||
|
|
||||||
{% include 'snippets/form_errors.html' with errors_list=form.wikipedia_link.errors id="desc_wikipedia_link" %}
|
{% include 'snippets/form_errors.html' with errors_list=form.wikipedia_link.errors id="desc_wikipedia_link" %}
|
||||||
|
|
||||||
<p class="field"><label class="label" for="id_website">{% trans "Website:" %}</label> {{ form.website }}</p>
|
<p class="field"><label class="label" for="id_website">{% trans "Website:" %}</label> {{ form.website }}</p>
|
||||||
|
|
|
@ -45,18 +45,22 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if book.series %}
|
{% if book.series %}
|
||||||
<meta itemprop="position" content="{{ book.series_number }}">
|
{% spaceless %}
|
||||||
<span itemprop="isPartOf" itemscope itemtype="https://schema.org/BookSeries">
|
<span itemprop="isPartOf" itemscope itemtype="https://schema.org/BookSeries">
|
||||||
{% if book.authors.exists %}
|
{% if book.authors.exists %}
|
||||||
<a href="{% url 'book-series-by' book.authors.first.id %}?series_name={{ book.series | urlencode }}"
|
<a href="{% url 'book-series-by' book.authors.first.id %}?series_name={{ book.series | urlencode }}"
|
||||||
itemprop="url">
|
itemprop="url">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span itemprop="name">{{ book.series }}</span>
|
<span itemprop="name">{{ book.series }}</span>
|
||||||
{% if book.series_number %} #{{ book.series_number }}{% endif %}
|
|
||||||
{% if book.authors.exists %}
|
{% if book.authors.exists %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
|
{% if book.series_number %}
|
||||||
|
<span>, #</span>
|
||||||
|
<span itemprop="position">{{ book.series_number }}</span>
|
||||||
|
{% endif %}
|
||||||
|
{% endspaceless %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
3
bookwyrm/templates/snippets/book_series.html
Normal file
3
bookwyrm/templates/snippets/book_series.html
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{% if book.series %}
|
||||||
|
({{book.series}}{%if book.series_number %}, #{{book.series_number}}{% endif %})
|
||||||
|
{% endif %}
|
|
@ -9,12 +9,15 @@
|
||||||
|
|
||||||
{% if book.authors.exists %}
|
{% if book.authors.exists %}
|
||||||
{% blocktrans trimmed with path=book.local_path title=book|book_title %}
|
{% blocktrans trimmed with path=book.local_path title=book|book_title %}
|
||||||
<a href="{{ path }}">{{ title }}</a> by
|
<a href="{{ path }}">{{ title }}</a>
|
||||||
|
by
|
||||||
{% endblocktrans %} {% include 'snippets/authors.html' with book=book limit=3 %}
|
{% endblocktrans %} {% include 'snippets/authors.html' with book=book limit=3 %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ book.local_path }}">{{ book|book_title }}</a>
|
<a href="{{ book.local_path }}">{{ book|book_title }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'snippets/book_series.html' with book=book %}
|
||||||
|
|
||||||
{% endcache %}
|
{% endcache %}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
|
@ -17,4 +17,7 @@ commented on <a href="{{ book_path }}">{{ book }}</a>
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'snippets/book_series.html' with book=book %}
|
||||||
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
|
@ -17,4 +17,7 @@ quoted <a href="{{ book_path }}">{{ book }}</a>
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'snippets/book_series.html' with book=book %}
|
||||||
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
|
@ -19,4 +19,7 @@ finished reading <a href="{{ book_path }}">{{ book }}</a>
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'snippets/book_series.html' with book=book %}
|
||||||
|
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
|
@ -19,4 +19,7 @@ started reading <a href="{{ book_path }}">{{ book }}</a>
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'snippets/book_series.html' with book=book %}
|
||||||
|
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
|
@ -17,4 +17,7 @@ reviewed <a href="{{ book_path }}">{{ book }}</a>
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'snippets/book_series.html' with book=book %}
|
||||||
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
|
@ -19,5 +19,8 @@ stopped reading <a href="{{ book_path }}">{{ book }}</a>
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'snippets/book_series.html' with book=book %}
|
||||||
|
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
||||||
|
|
|
@ -19,4 +19,7 @@ wants to read <a href="{{ book_path }}">{{ book }}</a>
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'snippets/book_series.html' with book=book %}
|
||||||
|
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
|
@ -136,6 +136,7 @@
|
||||||
],
|
],
|
||||||
"bio": "<p>American political scientist and anthropologist</p>",
|
"bio": "<p>American political scientist and anthropologist</p>",
|
||||||
"wikipediaLink": "https://en.wikipedia.org/wiki/James_C._Scott",
|
"wikipediaLink": "https://en.wikipedia.org/wiki/James_C._Scott",
|
||||||
|
"wikidata": "Q3025403",
|
||||||
"website": "",
|
"website": "",
|
||||||
"@context": "https://www.w3.org/ns/activitystreams"
|
"@context": "https://www.w3.org/ns/activitystreams"
|
||||||
}
|
}
|
||||||
|
@ -320,6 +321,7 @@
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"bio": "",
|
"bio": "",
|
||||||
"wikipediaLink": "",
|
"wikipediaLink": "",
|
||||||
|
"wikidata": "",
|
||||||
"website": "",
|
"website": "",
|
||||||
"@context": "https://www.w3.org/ns/activitystreams"
|
"@context": "https://www.w3.org/ns/activitystreams"
|
||||||
}
|
}
|
||||||
|
@ -396,4 +398,4 @@
|
||||||
"https://your.domain.here/user/rat"
|
"https://your.domain.here/user/rat"
|
||||||
],
|
],
|
||||||
"blocks": ["https://your.domain.here/user/badger"]
|
"blocks": ["https://your.domain.here/user/badger"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ from functools import reduce
|
||||||
import operator
|
import operator
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required
|
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.core.paginator import Paginator
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
@ -104,6 +105,13 @@ def switch_edition(request):
|
||||||
readthrough.book = new_edition
|
readthrough.book = new_edition
|
||||||
readthrough.save()
|
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(
|
reviews = models.Review.objects.filter(
|
||||||
book__parent_work=new_edition.parent_work, user=request.user
|
book__parent_work=new_edition.parent_work, user=request.user
|
||||||
)
|
)
|
||||||
|
|
|
@ -11,7 +11,7 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- main
|
- main
|
||||||
volumes:
|
volumes:
|
||||||
- ./nginx:/etc/nginx/conf.d:ro
|
- ./nginx:/etc/nginx/conf.d
|
||||||
- static_volume:/app/static
|
- static_volume:/app/static
|
||||||
- media_volume:/app/images
|
- media_volume:/app/images
|
||||||
db:
|
db:
|
||||||
|
@ -26,7 +26,7 @@ services:
|
||||||
env_file: .env
|
env_file: .env
|
||||||
command: python manage.py runserver 0.0.0.0:8000
|
command: python manage.py runserver 0.0.0.0:8000
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app:ro
|
- .:/app
|
||||||
- static_volume:/app/static
|
- static_volume:/app/static
|
||||||
- media_volume:/app/images
|
- media_volume:/app/images
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -41,7 +41,7 @@ services:
|
||||||
image: redis:7.2.1
|
image: redis:7.2.1
|
||||||
command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes --port ${REDIS_ACTIVITY_PORT}
|
command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes --port ${REDIS_ACTIVITY_PORT}
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis.conf:/etc/redis/redis.conf:ro
|
- ./redis.conf:/etc/redis/redis.conf
|
||||||
- redis_activity_data:/data
|
- redis_activity_data:/data
|
||||||
env_file: .env
|
env_file: .env
|
||||||
networks:
|
networks:
|
||||||
|
@ -51,7 +51,7 @@ services:
|
||||||
image: redis:7.2.1
|
image: redis:7.2.1
|
||||||
command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} --appendonly yes --port ${REDIS_BROKER_PORT}
|
command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} --appendonly yes --port ${REDIS_BROKER_PORT}
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis.conf:/etc/redis/redis.conf:ro
|
- ./redis.conf:/etc/redis/redis.conf
|
||||||
- redis_broker_data:/data
|
- redis_broker_data:/data
|
||||||
env_file: .env
|
env_file: .env
|
||||||
networks:
|
networks:
|
||||||
|
@ -64,7 +64,7 @@ services:
|
||||||
- main
|
- 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
|
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:
|
volumes:
|
||||||
- .:/app:ro
|
- .:/app
|
||||||
- static_volume:/app/static
|
- static_volume:/app/static
|
||||||
- media_volume:/app/images
|
- media_volume:/app/images
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -78,7 +78,7 @@ services:
|
||||||
- main
|
- main
|
||||||
command: celery -A celerywyrm beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler
|
command: celery -A celerywyrm beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app:ro
|
- .:/app
|
||||||
- static_volume:/app/static
|
- static_volume:/app/static
|
||||||
- media_volume:/app/images
|
- media_volume:/app/images
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -89,7 +89,7 @@ services:
|
||||||
command: celery -A celerywyrm flower --basic_auth=${FLOWER_USER}:${FLOWER_PASSWORD} --url_prefix=flower
|
command: celery -A celerywyrm flower --basic_auth=${FLOWER_USER}:${FLOWER_PASSWORD} --url_prefix=flower
|
||||||
env_file: .env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app:ro
|
- .:/app
|
||||||
- static_volume:/app/static
|
- static_volume:/app/static
|
||||||
networks:
|
networks:
|
||||||
- main
|
- main
|
||||||
|
@ -102,7 +102,7 @@ services:
|
||||||
env_file: .env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
- /app/dev-tools/
|
- /app/dev-tools/
|
||||||
- .:/app:rw
|
- .:/app
|
||||||
profiles:
|
profiles:
|
||||||
- tools
|
- tools
|
||||||
volumes:
|
volumes:
|
||||||
|
|
Loading…
Reference in a new issue