mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 08:51:09 -05:00
17 lines
590 B
Python
17 lines
590 B
Python
from django.contrib.contenttypes.fields import GenericRelation
|
|
|
|
from .models import get_comment_threads
|
|
|
|
class CommentableMixin:
|
|
"""
|
|
Mixin for models that should have comment functionality.
|
|
Uses composition instead of inheritance to avoid historical model issues.
|
|
"""
|
|
|
|
@property
|
|
def comments(self):
|
|
"""Get comments helper for this instance."""
|
|
if self.__class__.__name__.startswith('Historical'):
|
|
# Historical models delegate to their current instance
|
|
return self.instance.comments
|
|
return get_comment_threads(self) |