Content Revisions
Create a separate model for content revisions.
Should track changes over time.
Could this be part
Create a separate model for content revisions.
Should track changes over time.
Could this be part of socra with another subquery for revision count?
Thoughts:
- it's not ideal to create a revision for every single object with content created
- We would need to create at least one revision for every object created (Socras, updates, messages, etc.)
- Instead, we should only create content revisions when content changes
Scenario:
- user creates a socra with content. No revision is created when the socra is created
- When the content is edited, we create a revision containing the previous content
- At this point, we could in theory create a revision tracking the original content, and a revision tracking the changed content. This would allow us to bypass revisions for content that doesn't change
- [x] Implement Revision model
- [x] Any time content changes, new Revision should be created containing the previous content, and timestamp should contain the time the content is modified.
- [ ] Frontend
- [ ] show whether something has been edited
- [ ] menu to show edits.
### Revision Tracking Implementation
**Objective:** Track revisions to the `content` field in a Django model, creating revisions only when the content changes.
**Implementation Steps:**
1. **Initial Content Creation:**
- No revision is created when the content is initially set.
2. **First Edit:**
- When the content is edited for the first time, create a revision.
- **Revision Details:**
- **Timestamp:** The time when the content is saved.
- **Old Content:** The initial content before the edit.
3. **Subsequent Edits:**
- For each subsequent edit, create a new revision.
- **Revision Details:**
- **Timestamp:** The time when the content is saved.
- **Old Content:** The content before the current edit.
**Example Timeline:**
1. **Initial Creation:**
- **Timestamp:** 2023-10-01 10:00:00
- **Content:** "Initial content"
- **Action:** No revision created.
2. **First Edit:**
- **Timestamp:** 2023-10-05 14:30:00
- **Old Content:** "Initial content"
- **New Content:** "First edit content"
- **Action:** Create a revision with the old content and timestamp 2023-10-05 14:30:00.
3. **Second Edit:**
- **Timestamp:** 2023-10-10 09:15:00
- **Old Content:** "First edit content"
- **New Content:** "Second edit content"
- **Action:** Create a revision with the old content and timestamp 2023-10-10 09:15:00.
**Notes:**
- This approach minimizes data duplication by only creating revisions when changes occur.
- Each revision accurately reflects the time of the change, maintaining a clear and consistent history of edits.By Mike Morton