From 8d266fda4dca59ac106f097d8f4a15fdd1c9ec16 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 8 Apr 2022 15:21:06 -0700 Subject: [PATCH] Removes unused `related_book` field on notification model --- .../0149_remove_notification_related_book.py | 17 +++++++++++++++++ bookwyrm/models/notification.py | 2 -- bookwyrm/views/notifications.py | 1 - 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 bookwyrm/migrations/0149_remove_notification_related_book.py diff --git a/bookwyrm/migrations/0149_remove_notification_related_book.py b/bookwyrm/migrations/0149_remove_notification_related_book.py new file mode 100644 index 000000000..c976af6c9 --- /dev/null +++ b/bookwyrm/migrations/0149_remove_notification_related_book.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.12 on 2022-04-08 22:20 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("bookwyrm", "0148_alter_user_preferred_language"), + ] + + operations = [ + migrations.RemoveField( + model_name="notification", + name="related_book", + ), + ] diff --git a/bookwyrm/models/notification.py b/bookwyrm/models/notification.py index 417bf7591..28c5b803e 100644 --- a/bookwyrm/models/notification.py +++ b/bookwyrm/models/notification.py @@ -15,7 +15,6 @@ class Notification(BookWyrmModel): """you've been tagged, liked, followed, etc""" user = models.ForeignKey("User", on_delete=models.CASCADE) - related_book = models.ForeignKey("Edition", on_delete=models.CASCADE, null=True) related_user = models.ForeignKey( "User", on_delete=models.CASCADE, null=True, related_name="related_user" ) @@ -38,7 +37,6 @@ class Notification(BookWyrmModel): # there's probably a better way to do this if self.__class__.objects.filter( user=self.user, - related_book=self.related_book, related_user=self.related_user, related_group=self.related_group, related_status=self.related_status, diff --git a/bookwyrm/views/notifications.py b/bookwyrm/views/notifications.py index 0a7a62002..e081b07c3 100644 --- a/bookwyrm/views/notifications.py +++ b/bookwyrm/views/notifications.py @@ -22,7 +22,6 @@ class Notifications(View): "related_import", "related_report", "related_user", - "related_book", "related_list_item", "related_list_item__book", )