Refactor content status terminology and enhance cluster serializers with idea and content counts
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def migrate_content_status_forward(apps, schema_editor):
|
||||
Content = apps.get_model('writer', 'Content')
|
||||
Content.objects.filter(status='published').update(status='publish')
|
||||
|
||||
|
||||
def migrate_content_status_backward(apps, schema_editor):
|
||||
Content = apps.get_model('writer', 'Content')
|
||||
Content.objects.filter(status='publish').update(status='published')
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('writer', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='tasks',
|
||||
name='status',
|
||||
field=models.CharField(
|
||||
choices=[('queued', 'Queued'), ('completed', 'Completed')],
|
||||
default='queued',
|
||||
max_length=50,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='content',
|
||||
name='status',
|
||||
field=models.CharField(
|
||||
choices=[('draft', 'Draft'), ('review', 'Review'), ('publish', 'Publish')],
|
||||
default='draft',
|
||||
help_text='Content workflow status (draft, review, publish)',
|
||||
max_length=50,
|
||||
),
|
||||
),
|
||||
migrations.RunPython(
|
||||
migrate_content_status_forward,
|
||||
migrate_content_status_backward,
|
||||
),
|
||||
]
|
||||
|
||||
@@ -109,9 +109,9 @@ class Content(SiteSectorBaseModel):
|
||||
STATUS_CHOICES = [
|
||||
('draft', 'Draft'),
|
||||
('review', 'Review'),
|
||||
('published', 'Published'),
|
||||
('publish', 'Publish'),
|
||||
]
|
||||
status = models.CharField(max_length=50, choices=STATUS_CHOICES, default='draft', help_text="Content workflow status (draft, review, published)")
|
||||
status = models.CharField(max_length=50, choices=STATUS_CHOICES, default='draft', help_text="Content workflow status (draft, review, publish)")
|
||||
generated_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
|
||||
@@ -263,8 +263,8 @@ class TasksViewSet(SiteSectorModelViewSet):
|
||||
# Tasks module not available - update status only
|
||||
try:
|
||||
queryset = self.get_queryset()
|
||||
tasks = queryset.filter(id__in=ids, status__in=['queued', 'in_progress'])
|
||||
updated_count = tasks.update(status='draft', content='[AI content generation not available]')
|
||||
tasks = queryset.filter(id__in=ids, status='queued')
|
||||
updated_count = tasks.update(status='completed', content='[AI content generation not available]')
|
||||
|
||||
logger.info(f"auto_generate_content: Updated {updated_count} tasks (AI generation not available)")
|
||||
return Response({
|
||||
|
||||
Reference in New Issue
Block a user