Python formatting

This commit is contained in:
Mouse Reeve 2022-07-04 19:58:27 -07:00
parent dc8e61f316
commit b193652a67
2 changed files with 6 additions and 8 deletions

View file

@ -8,13 +8,13 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0150_readthrough_stopped_date'),
("bookwyrm", "0150_readthrough_stopped_date"),
]
operations = [
migrations.RemoveField(
model_name='notification',
name='related_book',
model_name="notification",
name="related_book",
),
migrations.AddField(
model_name="notification",

View file

@ -39,10 +39,7 @@ class Notification(BookWyrmModel):
"""Create a notification"""
if not user.local or user == related_user:
return
notification, _ = cls.objects.get_or_create(
user=user,
**kwargs
)
notification, _ = cls.objects.get_or_create(user=user, **kwargs)
notification.related_users.add(related_user)
notification.unread = True
notification.save()
@ -92,7 +89,7 @@ def notify_on_unfav(sender, instance, *args, **kwargs):
instance.status.user,
instance.user,
related_status=instance.status,
notification_type="FAVORITE"
notification_type="FAVORITE",
)
@ -195,5 +192,6 @@ def notify_admins_on_report(sender, instance, *args, **kwargs):
notification, _ = Notification.objects.get_or_create(
user=admin,
notification_type="REPORT",
unread=True,
)
notification.related_reports.add(instance)