mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-21 13:31:09 -05:00
Add comments app with models, views, and tests; integrate comments into existing models
This commit is contained in:
@@ -2,6 +2,7 @@ from django.db import models
|
||||
from django.utils.text import slugify
|
||||
from django.urls import reverse
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.contenttypes.fields import GenericRelation
|
||||
from typing import Tuple, Optional, ClassVar, TYPE_CHECKING
|
||||
from history_tracking.models import HistoricalModel, VersionBranch, ChangeSet
|
||||
from history_tracking.signals import get_current_branch, ChangesetContextManager
|
||||
@@ -19,6 +20,10 @@ class Company(HistoricalModel):
|
||||
total_rides = models.IntegerField(default=0)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
comments = GenericRelation('comments.CommentThread',
|
||||
related_name='company_threads',
|
||||
related_query_name='comments_thread'
|
||||
)
|
||||
|
||||
objects: ClassVar[models.Manager['Company']]
|
||||
|
||||
@@ -101,6 +106,10 @@ class Manufacturer(HistoricalModel):
|
||||
total_roller_coasters = models.IntegerField(default=0)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
comments = GenericRelation('comments.CommentThread',
|
||||
related_name='manufacturer_threads',
|
||||
related_query_name='comments_thread'
|
||||
)
|
||||
|
||||
objects: ClassVar[models.Manager['Manufacturer']]
|
||||
|
||||
@@ -181,6 +190,10 @@ class Designer(HistoricalModel):
|
||||
total_roller_coasters = models.IntegerField(default=0)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
comments = GenericRelation('comments.CommentThread',
|
||||
related_name='designer_threads',
|
||||
related_query_name='comments_thread'
|
||||
)
|
||||
|
||||
objects: ClassVar[models.Manager['Designer']]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user