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 7d7ebe1c0c
commit f000c492e8
18 changed files with 314 additions and 15 deletions

View File

@@ -58,6 +58,10 @@ class Park(HistoricalModel):
Company, on_delete=models.SET_NULL, null=True, blank=True, related_name="parks"
)
photos = GenericRelation(Photo, related_query_name="park")
comments = GenericRelation('comments.CommentThread',
related_name='park_threads',
related_query_name='comments_thread'
)
areas: models.Manager['ParkArea'] # Type hint for reverse relation
rides: models.Manager['Ride'] # Type hint for reverse relation from rides app
@@ -164,6 +168,12 @@ class ParkArea(HistoricalModel):
opening_date = models.DateField(null=True, blank=True)
closing_date = models.DateField(null=True, blank=True)
# Relationships
comments = GenericRelation('comments.CommentThread',
related_name='park_area_threads',
related_query_name='comments_thread'
)
# Metadata
created_at = models.DateTimeField(auto_now_add=True, null=True)
updated_at = models.DateTimeField(auto_now=True)