Make reports
This commit is contained in:
parent
e59c127686
commit
21f199c548
12 changed files with 96 additions and 19 deletions
|
@ -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 """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue