Merge branch 'main' into book-file-links

This commit is contained in:
Mouse Reeve
2022-01-09 13:15:58 -08:00
31 changed files with 12128 additions and 2545 deletions

View File

@ -14,6 +14,7 @@ def populate_lists_streams():
for user in users:
print(".", end="")
lists_stream.populate_lists_task.delay(user.id)
print("\nAll done, thank you for your patience!")
class Command(BaseCommand):

View File

@ -0,0 +1,36 @@
# Generated by Django 3.2.10 on 2022-01-09 01:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0124_auto_20220106_1759"),
]
operations = [
migrations.AlterField(
model_name="user",
name="preferred_language",
field=models.CharField(
blank=True,
choices=[
("en-us", "English"),
("de-de", "Deutsch (German)"),
("es-es", "Español (Spanish)"),
("gl-es", "Galego (Galician)"),
("it-it", "Italiano (Italian)"),
("fr-fr", "Français (French)"),
("lt-lt", "Lietuvių (Lithuanian)"),
("no-no", "Norsk (Norwegian)"),
("pt-br", "Português do Brasil (Brazilian Portuguese)"),
("pt-pt", "Português Europeu (European Portuguese)"),
("zh-hans", "简体中文 (Simplified Chinese)"),
("zh-hant", "繁體中文 (Traditional Chinese)"),
],
max_length=255,
null=True,
),
),
]

View File

@ -196,8 +196,10 @@ LANGUAGES = [
("de-de", _("Deutsch (German)")),
("es-es", _("Español (Spanish)")),
("gl-es", _("Galego (Galician)")),
("it-it", _("Italiano (Italian)")),
("fr-fr", _("Français (French)")),
("lt-lt", _("Lietuvių (Lithuanian)")),
("no-no", _("Norsk (Norwegian)")),
("pt-br", _("Português do Brasil (Brazilian Portuguese)")),
("pt-pt", _("Português Europeu (European Portuguese)")),
("zh-hans", _("简体中文 (Simplified Chinese)")),
@ -220,6 +222,7 @@ USER_AGENT = f"{agent} (BookWyrm/{VERSION}; +https://{DOMAIN}/)"
# Imagekit generated thumbnails
ENABLE_THUMBNAIL_GENERATION = env.bool("ENABLE_THUMBNAIL_GENERATION", False)
IMAGEKIT_CACHEFILE_DIR = "thumbnails"
IMAGEKIT_DEFAULT_CACHEFILE_STRATEGY = "bookwyrm.thumbnail_generation.Strategy"
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/

View File

@ -21,7 +21,7 @@
<p class="subtitle notification has-background-primary-light">
{% blocktrans trimmed with site_name=site.name %}
{{ site_name }} is part of <em>BookWyrm</em>, a network of independent, self-directed communities for readers.
While you can interact seemlessly with users anywhere in the <a href="https://joinbookwyrm.com/instances/" target="_blank">BookWyrm network</a>, this community is unique.
While you can interact seamlessly with users anywhere in the <a href="https://joinbookwyrm.com/instances/" target="_blank">BookWyrm network</a>, this community is unique.
{% endblocktrans %}
</p>

View File

@ -168,7 +168,7 @@
<div class="column is-3">
{% trans "…and the longest" %}
<p class="title is-4 is-serif is-italic">
<a href="{{ book_pages_lowest.local_path }}" class="has-text-success-dark">
<a href="{{ book_pages_highest.local_path }}" class="has-text-success-dark">
{{ book_pages_highest.title }}
</a>
</p>

View File

@ -0,0 +1,20 @@
"""thumbnail generation strategy for django-imagekit"""
class Strategy:
"""
A strategy that generates the image on source saved (Optimistic),
but also on demand, for old images (JustInTime).
"""
def on_source_saved(self, file): # pylint: disable=no-self-use
"""What happens on source saved"""
file.generate()
def on_existence_required(self, file): # pylint: disable=no-self-use
"""What happens on existence required"""
file.generate()
def on_content_required(self, file): # pylint: disable=no-self-use
"""What happens on content required"""
file.generate()

View File

@ -19,7 +19,9 @@ def about(request):
"status_count": models.Status.objects.filter(
user__local=True, deleted=False
).count(),
"admins": models.User.objects.filter(groups__name__in=["admin", "moderator"]),
"admins": models.User.objects.filter(
groups__name__in=["admin", "moderator"]
).distinct(),
"version": settings.VERSION,
}