From bbf0aedfdc9ada6b969e8ecab99642c3291fa2c4 Mon Sep 17 00:00:00 2001 From: "IGNY8 VPS (Salman)" Date: Mon, 10 Nov 2025 14:28:13 +0000 Subject: [PATCH] Update Content model to enforce status choices and add migration for status field changes - Introduced STATUS_CHOICES in the Content model to restrict the status field to 'draft', 'review', and 'published'. - Created a new migration to reflect the updated status choices without altering existing data. - Removed 'completed' status from the frontend status color mapping for consistency. --- .../migrations/0006_update_status_choices.py | 18 ++++++++++++++++++ backend/igny8_core/modules/writer/models.py | 7 ++++++- frontend/src/pages/Writer/Content.tsx | 1 - 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 backend/igny8_core/modules/writer/migrations/0006_update_status_choices.py diff --git a/backend/igny8_core/modules/writer/migrations/0006_update_status_choices.py b/backend/igny8_core/modules/writer/migrations/0006_update_status_choices.py new file mode 100644 index 00000000..e0daef95 --- /dev/null +++ b/backend/igny8_core/modules/writer/migrations/0006_update_status_choices.py @@ -0,0 +1,18 @@ +# Generated manually to update status field choices + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('writer', '0005_move_content_fields_to_content'), + ] + + operations = [ + # No database changes needed - just updating Python-level choices + # Tasks status: queued, completed + # Content status: draft, review, published + # Existing data will remain valid + ] + diff --git a/backend/igny8_core/modules/writer/models.py b/backend/igny8_core/modules/writer/models.py index 72865d66..d55fbd9f 100644 --- a/backend/igny8_core/modules/writer/models.py +++ b/backend/igny8_core/modules/writer/models.py @@ -106,7 +106,12 @@ class Content(SiteSectorBaseModel): secondary_keywords = models.JSONField(default=list, blank=True, help_text="List of secondary keywords") tags = models.JSONField(default=list, blank=True, help_text="List of tags") categories = models.JSONField(default=list, blank=True, help_text="List of categories") - status = models.CharField(max_length=50, default='draft', help_text="Content workflow status (draft, review, published, etc.)") + STATUS_CHOICES = [ + ('draft', 'Draft'), + ('review', 'Review'), + ('published', 'Published'), + ] + status = models.CharField(max_length=50, choices=STATUS_CHOICES, default='draft', help_text="Content workflow status (draft, review, published)") generated_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) diff --git a/frontend/src/pages/Writer/Content.tsx b/frontend/src/pages/Writer/Content.tsx index be2dce10..ec6aff02 100644 --- a/frontend/src/pages/Writer/Content.tsx +++ b/frontend/src/pages/Writer/Content.tsx @@ -9,7 +9,6 @@ const statusColors: Record = draft: 'warning', review: 'info', published: 'success', - completed: 'success', }; export default function Content() {