Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
434cb7e
Create suggestion list
joachimesque Jan 1, 2023
acd3799
Add list creation button
joachimesque Jan 1, 2023
fe05e31
Fix field doc
joachimesque Jan 1, 2023
25af64f
Display books in list
joachimesque Jan 1, 2023
4712673
Add book suggestion
joachimesque Jan 1, 2023
aee1af5
black ✨ 🍰 ✨
joachimesque Jan 1, 2023
3cb548f
Switch from subclass to new column
joachimesque Jan 1, 2023
630bbc1
Update template with new column names
joachimesque Jan 1, 2023
6de97ae
Add get_name for dynamically generated name and description
joachimesque Jan 1, 2023
f81c161
Limit what's displayed on list page
joachimesque Jan 1, 2023
067ce29
black
joachimesque Jan 1, 2023
2faaea6
docstrings
joachimesque Jan 1, 2023
62c9c71
Replace ignore_id with ignore_book
joachimesque Jan 1, 2023
80ce4ec
Display the right lists in the Book sidebar
joachimesque Jan 1, 2023
88da825
Update ordered_collection.py
joachimesque Jan 1, 2023
bee38cd
Add defauult
joachimesque Jan 1, 2023
23b0219
Merge branch 'main' into suggestion-list
joachimesque Jan 6, 2023
b88df90
Merge branch 'main' into suggestion-list
mouse-reeve Jan 11, 2023
a9347f7
Merge branch 'main' into suggestion-list
joachimesque Aug 1, 2023
486278b
Black 🕴️
joachimesque Aug 1, 2023
0f93833
Update migration
joachimesque Aug 1, 2023
9d6136e
Merge branch 'main' into suggestion-list
mouse-reeve Aug 26, 2024
8dc8196
Updates migration to avoid involved merge
mouse-reeve Aug 26, 2024
7603d18
Wrap card columns in suggestions list
mouse-reeve Aug 26, 2024
cc70e83
Re-styles suggstions to show the recommender's notes
mouse-reeve Aug 26, 2024
68fa3de
Makes "add suggestions" section a detail element
mouse-reeve Aug 26, 2024
e8a95a2
Moves book suggestion markup to a snippet
mouse-reeve Aug 26, 2024
5ea9358
Only show three suggestions on the book page
mouse-reeve Aug 26, 2024
500bd84
hide description if note is present for suggestion card
mouse-reeve Aug 26, 2024
ed5ae4a
Merge branch 'main' into suggestion-list
mouse-reeve Aug 26, 2024
01d7088
Show suggestion list suggestions in columns
mouse-reeve Aug 26, 2024
6b615d4
Adds a couple suggestions tests
mouse-reeve Aug 26, 2024
0034653
Uses a separate model for suggestion lists
mouse-reeve Aug 27, 2024
5879b4b
Adds missing view file
mouse-reeve Aug 27, 2024
2e15c22
Fixes adding books from list page view
mouse-reeve Aug 27, 2024
c901d76
Allow users to remove books from suggestion lists
mouse-reeve Aug 27, 2024
5f906e3
Updates migrations
mouse-reeve Aug 27, 2024
12291c9
Adds endorsement functionality
mouse-reeve Aug 27, 2024
782ca09
Updates tests
mouse-reeve Aug 27, 2024
c95408a
Merge branch 'main' into suggestion-list
mouse-reeve Aug 27, 2024
299ac06
adds merge migration
mouse-reeve Aug 27, 2024
5deb779
Associate suggestions with works instead of editions
mouse-reeve Aug 27, 2024
1bccffa
Uses separate activitypub type of suggestion lists
mouse-reeve Aug 27, 2024
aee089f
Support suggestion filtering when ignore book isn't present
mouse-reeve Aug 27, 2024
6b622ba
Adds more tests
mouse-reeve Aug 27, 2024
0b171b0
Adds type annotation to suggestion list view file
mouse-reeve Aug 28, 2024
b5b9a4f
Fixes placement of ignores that black muddled (rude)
mouse-reeve Aug 28, 2024
215eafb
Merge branch 'main' into suggestion-list
mouse-reeve Oct 15, 2025
5d5f89f
Updates migration path
mouse-reeve Oct 15, 2025
edfdfd2
Updates UI for better handling of null and logged out states
mouse-reeve Oct 15, 2025
45486e6
Fixes suggestion mode in regular list for for suggestion list
mouse-reeve Oct 15, 2025
e8278fc
Show number of items by "view all" link
mouse-reeve Oct 15, 2025
0725dae
Adds inbox test and tweaks serialization
mouse-reeve Oct 15, 2025
acb9280
Fixing linting issue
mouse-reeve Oct 15, 2025
498d0de
Suppress line too long warning in suggestions test
mouse-reeve Oct 15, 2025
508f1cf
Merge branch 'main' into suggestion-list
mouse-reeve Nov 16, 2025
73f437e
Adds merge migration
mouse-reeve Nov 16, 2025
b3bb96a
Modifies language on "create" step of suggestion list
mouse-reeve Nov 16, 2025
e312fac
Adds shelve button to suggestion item
mouse-reeve Nov 16, 2025
8be586f
Merge branch 'main' into suggestion-list
mouse-reeve Nov 22, 2025
d79697f
Merge branch 'main' into suggestion-list
mouse-reeve Feb 4, 2026
3ab674c
Ruff formatting
mouse-reeve Feb 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bookwyrm/activitypub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from .note import Review, Rating
from .note import Tombstone
from .ordered_collection import OrderedCollection, OrderedCollectionPage
from .ordered_collection import CollectionItem, ListItem, ShelfItem
from .ordered_collection import BookList, Shelf
from .ordered_collection import CollectionItem, ListItem, ShelfItem, SuggestionListItem
from .ordered_collection import BookList, SuggestionList, Shelf
from .person import Person, PublicKey
from .response import ActivitypubResponse
from .book import Edition, Work, Author
Expand Down
19 changes: 19 additions & 0 deletions bookwyrm/activitypub/ordered_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import List

from .base_activity import ActivityObject
from .book import Work


@dataclass(init=False)
Expand Down Expand Up @@ -42,6 +43,15 @@ class BookList(OrderedCollectionPrivate):
type: str = "BookList"


@dataclass(init=False)
class SuggestionList(OrderedCollectionPrivate):
"""structure of an ordered collection activity"""

summary: str = None
book: Work = None
type: str = "SuggestionList"


@dataclass(init=False)
class OrderedCollectionPage(ActivityObject):
"""structure of an ordered collection activity"""
Expand Down Expand Up @@ -72,6 +82,15 @@ class ListItem(CollectionItem):
type: str = "ListItem"


@dataclass(init=False)
class SuggestionListItem(CollectionItem):
"""a book on a list"""

book: str
notes: str = None
type: str = "SuggestionListItem"


@dataclass(init=False)
class ShelfItem(CollectionItem):
"""a book on a list"""
Expand Down
12 changes: 12 additions & 0 deletions bookwyrm/forms/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ class Meta:
fields = ["user", "book", "book_list", "notes"]


class SuggestionListForm(CustomForm):
class Meta:
model = models.SuggestionList
fields = ["suggests_for"]


class SuggestionListItemForm(CustomForm):
class Meta:
model = models.SuggestionListItem
fields = ["user", "book", "book_list", "notes"]


class SortListForm(forms.Form):
sort_by = ChoiceField(
choices=(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Generated by Django 5.2.3 on 2025-10-15 18:14

import bookwyrm.models.activitypub_mixin
import bookwyrm.models.fields
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0218_merge_0217_merge_20250816_0749_0217_usersession"),
]

operations = [
migrations.AlterModelOptions(
name="listitem",
options={},
),
migrations.CreateModel(
name="SuggestionList",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("created_date", models.DateTimeField(auto_now_add=True)),
("updated_date", models.DateTimeField(auto_now=True)),
(
"remote_id",
bookwyrm.models.fields.RemoteIdField(
max_length=255,
null=True,
validators=[bookwyrm.models.fields.validate_remote_id],
),
),
("embed_key", models.UUIDField(editable=False, null=True, unique=True)),
(
"privacy",
bookwyrm.models.fields.PrivacyField(
choices=[
("public", "Public"),
("unlisted", "Unlisted"),
("followers", "Followers"),
("direct", "Private"),
],
default="public",
max_length=255,
),
),
(
"suggests_for",
bookwyrm.models.fields.OneToOneField(
on_delete=django.db.models.deletion.PROTECT,
related_name="suggestion_list",
to="bookwyrm.work",
),
),
(
"user",
bookwyrm.models.fields.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"ordering": ("-updated_date",),
"abstract": False,
},
bases=(
bookwyrm.models.activitypub_mixin.OrderedCollectionMixin,
models.Model,
),
),
migrations.CreateModel(
name="SuggestionListItem",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("created_date", models.DateTimeField(auto_now_add=True)),
("updated_date", models.DateTimeField(auto_now=True)),
(
"remote_id",
bookwyrm.models.fields.RemoteIdField(
max_length=255,
null=True,
validators=[bookwyrm.models.fields.validate_remote_id],
),
),
(
"notes",
bookwyrm.models.fields.HtmlField(
blank=True, max_length=300, null=True
),
),
(
"book",
bookwyrm.models.fields.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
to="bookwyrm.edition",
),
),
(
"book_list",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="bookwyrm.suggestionlist",
),
),
(
"endorsement",
models.ManyToManyField(
related_name="suggestion_endorsers", to=settings.AUTH_USER_MODEL
),
),
(
"user",
bookwyrm.models.fields.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"ordering": ("-created_date",),
"abstract": False,
"unique_together": {("book", "book_list")},
},
bases=(bookwyrm.models.activitypub_mixin.CollectionItemMixin, models.Model),
),
migrations.AddField(
model_name="suggestionlist",
name="books",
field=models.ManyToManyField(
through="bookwyrm.SuggestionListItem",
through_fields=("book_list", "book"),
to="bookwyrm.edition",
),
),
]
13 changes: 13 additions & 0 deletions bookwyrm/migrations/0224_merge_20251116_1928.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 5.2.3 on 2025-11-16 19:28

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0219_alter_listitem_options_suggestionlist_and_more"),
("bookwyrm", "0223_sitesettings_disable_federation"),
]

operations = []
1 change: 1 addition & 0 deletions bookwyrm/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from .shelf import Shelf, ShelfBook
from .list import List, ListItem
from .list import SuggestionList, SuggestionListItem

from .status import Status, GeneratedNote, Comment, Quotation
from .status import Review, ReviewRating
Expand Down
4 changes: 2 additions & 2 deletions bookwyrm/models/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,11 +636,11 @@ class BooleanField(ActivitypubFieldMixin, models.BooleanField):


class IntegerField(ActivitypubFieldMixin, models.IntegerField):
"""activitypub-aware boolean field"""
"""activitypub-aware integer field"""


class DecimalField(ActivitypubFieldMixin, models.DecimalField):
"""activitypub-aware boolean field"""
"""activitypub-aware decimal field"""

def field_to_activity(self, value):
if not value:
Expand Down
Loading
Loading