From 54e0fdd5ae3a8afdd48c3926e8176aadf5622e09 Mon Sep 17 00:00:00 2001 From: Jascha Urbach Date: Sun, 15 Jan 2023 09:41:39 +0100 Subject: [PATCH] Here we go again! --- bookwyrm/activitypub/book.py | 1 + bookwyrm/forms/author.py | 2 ++ bookwyrm/migrations/0173_author_website.py | 21 +++++++++++++++++++++ bookwyrm/models/author.py | 4 ++++ bookwyrm/templates/author/author.html | 10 +++++++++- bookwyrm/templates/author/edit_author.html | 4 ++++ 6 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 bookwyrm/migrations/0173_author_website.py diff --git a/bookwyrm/activitypub/book.py b/bookwyrm/activitypub/book.py index 745aa3aab..d3aca4471 100644 --- a/bookwyrm/activitypub/book.py +++ b/bookwyrm/activitypub/book.py @@ -92,3 +92,4 @@ class Author(BookData): bio: str = "" wikipediaLink: str = "" type: str = "Author" + website: str = "" diff --git a/bookwyrm/forms/author.py b/bookwyrm/forms/author.py index 3d71d4034..5b54a07b5 100644 --- a/bookwyrm/forms/author.py +++ b/bookwyrm/forms/author.py @@ -15,6 +15,7 @@ class AuthorForm(CustomForm): "aliases", "bio", "wikipedia_link", + "website", "born", "died", "openlibrary_key", @@ -31,6 +32,7 @@ class AuthorForm(CustomForm): "wikipedia_link": forms.TextInput( attrs={"aria-describedby": "desc_wikipedia_link"} ), + "website": forms.TextInput(attrs={"aria-describedby": "desc_website"}), "born": forms.SelectDateWidget(attrs={"aria-describedby": "desc_born"}), "died": forms.SelectDateWidget(attrs={"aria-describedby": "desc_died"}), "openlibrary_key": forms.TextInput( diff --git a/bookwyrm/migrations/0173_author_website.py b/bookwyrm/migrations/0173_author_website.py new file mode 100644 index 000000000..fda3debf1 --- /dev/null +++ b/bookwyrm/migrations/0173_author_website.py @@ -0,0 +1,21 @@ +# Generated by Django 3.2.16 on 2023-01-15 08:38 + +import bookwyrm.models.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("bookwyrm", "0172_alter_user_preferred_language"), + ] + + operations = [ + migrations.AddField( + model_name="author", + name="website", + field=bookwyrm.models.fields.CharField( + blank=True, max_length=255, null=True + ), + ), + ] diff --git a/bookwyrm/models/author.py b/bookwyrm/models/author.py index b1d0510c9..5c0c087b2 100644 --- a/bookwyrm/models/author.py +++ b/bookwyrm/models/author.py @@ -25,6 +25,10 @@ class Author(BookDataModel): isfdb = fields.CharField( max_length=255, blank=True, null=True, deduplication_field=True ) + + website = fields.CharField( + max_length=255, blank=True, null=True, deduplication_field=True + ) # idk probably other keys would be useful here? born = fields.DateTimeField(blank=True, null=True) died = fields.DateTimeField(blank=True, null=True) diff --git a/bookwyrm/templates/author/author.html b/bookwyrm/templates/author/author.html index ade654568..909f2435c 100644 --- a/bookwyrm/templates/author/author.html +++ b/bookwyrm/templates/author/author.html @@ -28,7 +28,7 @@ {% firstof author.aliases author.born author.died as details %} - {% firstof author.wikipedia_link author.openlibrary_key author.inventaire_id author.isni author.isfdb as links %} + {% firstof author.wikipedia_link author.website author.openlibrary_key author.inventaire_id author.isni author.isfdb as links %} {% if details or links %}
{% if details %} @@ -73,6 +73,14 @@
{% endif %} + {% if author.website %} +
+ + {% trans "Website" %} + +
+ {% endif %} + {% if author.isni %}
diff --git a/bookwyrm/templates/author/edit_author.html b/bookwyrm/templates/author/edit_author.html index 54b547a3b..12ddc4d28 100644 --- a/bookwyrm/templates/author/edit_author.html +++ b/bookwyrm/templates/author/edit_author.html @@ -57,6 +57,10 @@ {% include 'snippets/form_errors.html' with errors_list=form.wikipedia_link.errors id="desc_wikipedia_link" %} +

{{ form.website }}

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