mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-09-29 23:02:02 +00:00
Python formatting
This commit is contained in:
parent
dc8e61f316
commit
b193652a67
2 changed files with 6 additions and 8 deletions
|
@ -8,13 +8,13 @@ import django.db.models.deletion
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('bookwyrm', '0150_readthrough_stopped_date'),
|
("bookwyrm", "0150_readthrough_stopped_date"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name='notification',
|
model_name="notification",
|
||||||
name='related_book',
|
name="related_book",
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="notification",
|
model_name="notification",
|
||||||
|
|
|
@ -39,10 +39,7 @@ class Notification(BookWyrmModel):
|
||||||
"""Create a notification"""
|
"""Create a notification"""
|
||||||
if not user.local or user == related_user:
|
if not user.local or user == related_user:
|
||||||
return
|
return
|
||||||
notification, _ = cls.objects.get_or_create(
|
notification, _ = cls.objects.get_or_create(user=user, **kwargs)
|
||||||
user=user,
|
|
||||||
**kwargs
|
|
||||||
)
|
|
||||||
notification.related_users.add(related_user)
|
notification.related_users.add(related_user)
|
||||||
notification.unread = True
|
notification.unread = True
|
||||||
notification.save()
|
notification.save()
|
||||||
|
@ -92,7 +89,7 @@ def notify_on_unfav(sender, instance, *args, **kwargs):
|
||||||
instance.status.user,
|
instance.status.user,
|
||||||
instance.user,
|
instance.user,
|
||||||
related_status=instance.status,
|
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(
|
notification, _ = Notification.objects.get_or_create(
|
||||||
user=admin,
|
user=admin,
|
||||||
notification_type="REPORT",
|
notification_type="REPORT",
|
||||||
|
unread=True,
|
||||||
)
|
)
|
||||||
notification.related_reports.add(instance)
|
notification.related_reports.add(instance)
|
||||||
|
|
Loading…
Reference in a new issue