Add comments app with models, views, and tests; integrate comments into existing models

This commit is contained in:
pacnpal
2025-02-07 21:58:02 -05:00
parent 86ae24bbac
commit 75f5b07129
18 changed files with 314 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
from django.db import models
from django.urls import reverse
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.core.validators import MinValueValidator, MaxValueValidator
from history_tracking.models import HistoricalModel, VersionBranch, ChangeSet
@@ -40,6 +40,12 @@ class Review(HistoricalModel):
related_name='moderated_reviews'
)
moderated_at = models.DateTimeField(null=True, blank=True)
# Comments
comments = GenericRelation('comments.CommentThread',
related_name='review_threads',
related_query_name='comments_thread'
)
class Meta:
ordering = ['-created_at']