mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 10:11:09 -05:00
924 B
924 B
Updated Moderation Workflow with django-pghistory
Submission Lifecycle
- Change Proposal
- Creates
pendingpghistory event with metadata:pghistory.track( pghistory.Snapshot('submission.pending'), status='pending' )
- Creates
- Approval Process
- Merges event into main history:
event.pgh_label = 'approved_change' event.pgh_context['approver'] = request.user
- Merges event into main history:
- Rejection Handling
- Preserves event with rejection context:
event.pgh_label = 'rejected_change' event.pgh_context['reason'] = rejection_reason
- Preserves event with rejection context:
Moderation Admin Integration
# moderation/admin.py
@admin.register(pghistory.models.Event)
class HistoryAdmin(admin.ModelAdmin):
list_display = ('pgh_label', 'pgh_created_at', 'content_object')
readonly_fields = ('pgh_data', 'pgh_context')