Make reports
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
""" flagged for moderation """
|
||||
from django.db import models
|
||||
from django.db.models import F, Q
|
||||
from .base_model import BookWyrmModel
|
||||
|
||||
|
||||
@ -11,9 +12,17 @@ class Report(BookWyrmModel):
|
||||
)
|
||||
note = models.TextField(null=True, blank=True)
|
||||
user = models.ForeignKey("User", on_delete=models.PROTECT)
|
||||
statuses = models.ManyToManyField("Status")
|
||||
statuses = models.ManyToManyField("Status", null=True, blank=True)
|
||||
resolved = models.BooleanField(default=False)
|
||||
|
||||
class Meta:
|
||||
""" don't let users report themselves """
|
||||
constraints = [
|
||||
models.CheckConstraint(
|
||||
check=~Q(reporter=F('user')),
|
||||
name='self_report'
|
||||
)
|
||||
]
|
||||
|
||||
class ReportComment(BookWyrmModel):
|
||||
""" updates on a report """
|
||||
|
Reference in New Issue
Block a user