mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-22 19:11:08 -05:00
Refactor comments app to use mixins for comment functionality; update admin interfaces and add historical model fixes
This commit is contained in:
33
memory-bank/evaluations/historical_model_comment_fixes.md
Normal file
33
memory-bank/evaluations/historical_model_comment_fixes.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Historical Model Comment Fixes
|
||||
|
||||
## Problem
|
||||
System check errors occurred because historical models referenced CommentThread in their own app context (e.g. `companies.commentthread`) instead of the actual `comments.CommentThread` model.
|
||||
|
||||
## Solution
|
||||
Added `excluded_fields = ['comments']` to Meta classes of all affected models to exclude comment relationships from historical tracking. Note: Initially tried `history_exclude` but this was incorrect - django-simple-history uses `excluded_fields`.
|
||||
|
||||
## Affected Models (Fixed)
|
||||
- Company (companies/models.py)
|
||||
- Manufacturer (companies/models.py)
|
||||
- Designer (companies/models.py)
|
||||
- Park (parks/models.py)
|
||||
- ParkArea (parks/models.py)
|
||||
- Ride (rides/models.py)
|
||||
- RideModel (rides/models.py)
|
||||
- Review (reviews/models.py)
|
||||
|
||||
## Implementation Details
|
||||
Each model's Meta class was updated to exclude the comments field from historical tracking:
|
||||
|
||||
```python
|
||||
class Meta:
|
||||
# ... other Meta options ...
|
||||
excluded_fields = ['comments'] # Exclude from historical tracking
|
||||
```
|
||||
|
||||
This prevents django-simple-history from attempting to track the GenericRelation field in historical models, which was causing the system check errors.
|
||||
|
||||
## Verification
|
||||
Run system checks to verify fix:
|
||||
```bash
|
||||
python manage.py check
|
||||
Reference in New Issue
Block a user