Black formatting

This commit is contained in:
Mouse Reeve 2021-03-16 12:59:25 -07:00
parent e5750de3dd
commit 550eba1f68
2 changed files with 47 additions and 14 deletions

View file

@ -7,26 +7,60 @@ import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('bookwyrm', '0050_auto_20210313_0030'), ("bookwyrm", "0050_auto_20210313_0030"),
] ]
operations = [ operations = [
migrations.RemoveConstraint( migrations.RemoveConstraint(
model_name='notification', model_name="notification",
name='notification_type_valid', name="notification_type_valid",
), ),
migrations.AddField( migrations.AddField(
model_name='notification', model_name="notification",
name='related_report', name="related_report",
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='bookwyrm.Report'), field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="bookwyrm.Report",
),
), ),
migrations.AlterField( migrations.AlterField(
model_name='notification', model_name="notification",
name='notification_type', 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), 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( migrations.AddConstraint(
model_name='notification', 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'), constraint=models.CheckConstraint(
check=models.Q(
notification_type__in=[
"FAVORITE",
"REPLY",
"MENTION",
"TAG",
"FOLLOW",
"FOLLOW_REQUEST",
"BOOST",
"IMPORT",
"ADD",
"REPORT",
]
),
name="notification_type_valid",
),
), ),
] ]

View file

@ -22,8 +22,8 @@ class Report(BookWyrmModel):
user_model = apps.get_model("bookwyrm.User", require_ready=True) user_model = apps.get_model("bookwyrm.User", require_ready=True)
# moderators and superusers should be notified # moderators and superusers should be notified
admins = user_model.objects.filter( admins = user_model.objects.filter(
Q(user_permissions__name__in=["moderate_user", "moderate_post"]) | Q(user_permissions__name__in=["moderate_user", "moderate_post"])
Q(is_superuser=True) | Q(is_superuser=True)
).all() ).all()
notification_model = apps.get_model("bookwyrm.Notification", require_ready=True) notification_model = apps.get_model("bookwyrm.Notification", require_ready=True)
for admin in admins: for admin in admins:
@ -33,7 +33,6 @@ class Report(BookWyrmModel):
notification_type="REPORT", notification_type="REPORT",
) )
class Meta: class Meta:
""" don't let users report themselves """ """ don't let users report themselves """