mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 15:11:09 -05:00
Add comments app with models, views, and tests; integrate comments into existing models
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user