From 550eba1f6881d4aa8ed09e1bb239bdb4d51396bd Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 16 Mar 2021 12:59:25 -0700 Subject: [PATCH] Black formatting --- .../migrations/0051_auto_20210316_1950.py | 56 +++++++++++++++---- bookwyrm/models/report.py | 5 +- 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/bookwyrm/migrations/0051_auto_20210316_1950.py b/bookwyrm/migrations/0051_auto_20210316_1950.py index d8695d5cf..3caecbbe1 100644 --- a/bookwyrm/migrations/0051_auto_20210316_1950.py +++ b/bookwyrm/migrations/0051_auto_20210316_1950.py @@ -7,26 +7,60 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('bookwyrm', '0050_auto_20210313_0030'), + ("bookwyrm", "0050_auto_20210313_0030"), ] operations = [ migrations.RemoveConstraint( - model_name='notification', - name='notification_type_valid', + model_name="notification", + name="notification_type_valid", ), migrations.AddField( - model_name='notification', - name='related_report', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='bookwyrm.Report'), + model_name="notification", + name="related_report", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="bookwyrm.Report", + ), ), migrations.AlterField( - model_name='notification', - name='notification_type', - field=models.CharField(choices=[('FAVORITE', 'Favorite'), ('REPLY', 'Reply'), ('MENTION', 'Mention'), ('TAG', 'Tag'), ('FOLLOW', 'Follow'), ('FOLLOW_REQUEST', 'Follow Request'), ('BOOST', 'Boost'), ('IMPORT', 'Import'), ('ADD', 'Add'), ('REPORT', 'Report')], max_length=255), + model_name="notification", + name="notification_type", + field=models.CharField( + choices=[ + ("FAVORITE", "Favorite"), + ("REPLY", "Reply"), + ("MENTION", "Mention"), + ("TAG", "Tag"), + ("FOLLOW", "Follow"), + ("FOLLOW_REQUEST", "Follow Request"), + ("BOOST", "Boost"), + ("IMPORT", "Import"), + ("ADD", "Add"), + ("REPORT", "Report"), + ], + max_length=255, + ), ), migrations.AddConstraint( - model_name='notification', - constraint=models.CheckConstraint(check=models.Q(notification_type__in=['FAVORITE', 'REPLY', 'MENTION', 'TAG', 'FOLLOW', 'FOLLOW_REQUEST', 'BOOST', 'IMPORT', 'ADD', 'REPORT']), name='notification_type_valid'), + model_name="notification", + constraint=models.CheckConstraint( + check=models.Q( + notification_type__in=[ + "FAVORITE", + "REPLY", + "MENTION", + "TAG", + "FOLLOW", + "FOLLOW_REQUEST", + "BOOST", + "IMPORT", + "ADD", + "REPORT", + ] + ), + name="notification_type_valid", + ), ), ] diff --git a/bookwyrm/models/report.py b/bookwyrm/models/report.py index bdd7765ec..f9e8905bf 100644 --- a/bookwyrm/models/report.py +++ b/bookwyrm/models/report.py @@ -22,8 +22,8 @@ class Report(BookWyrmModel): user_model = apps.get_model("bookwyrm.User", require_ready=True) # moderators and superusers should be notified admins = user_model.objects.filter( - Q(user_permissions__name__in=["moderate_user", "moderate_post"]) | - Q(is_superuser=True) + Q(user_permissions__name__in=["moderate_user", "moderate_post"]) + | Q(is_superuser=True) ).all() notification_model = apps.get_model("bookwyrm.Notification", require_ready=True) for admin in admins: @@ -33,7 +33,6 @@ class Report(BookWyrmModel): notification_type="REPORT", ) - class Meta: """ don't let users report themselves """