Add flag field to Submission model with FlagChoices enum

Adds red/blue/green/yellow flag options for marking submissions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 17:23:05 +08:00
parent 9e8c3d7ebb
commit aa344b92e5
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
# Generated by Django 6.0.1 on 2026-03-09 09:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('submission', '0003_submission_conversation'),
]
operations = [
migrations.AddField(
model_name='submission',
name='flag',
field=models.CharField(blank=True, choices=[('red', '值得展示'), ('blue', '需要讲解'), ('green', '优秀作品'), ('yellow', '需要改进')], default=None, max_length=10, null=True, verbose_name='标记'),
),
]

View File

@@ -11,6 +11,13 @@ from task.models import Task
from prompt.models import Conversation from prompt.models import Conversation
class FlagChoices(models.TextChoices):
RED = "red", "值得展示"
BLUE = "blue", "需要讲解"
GREEN = "green", "优秀作品"
YELLOW = "yellow", "需要改进"
class Submission(TimeStampedModel): class Submission(TimeStampedModel):
id = models.UUIDField( id = models.UUIDField(
primary_key=True, primary_key=True,
@@ -31,6 +38,14 @@ class Submission(TimeStampedModel):
Conversation, on_delete=models.SET_NULL, null=True, blank=True, Conversation, on_delete=models.SET_NULL, null=True, blank=True,
related_name="submissions", verbose_name="对话" related_name="submissions", verbose_name="对话"
) )
flag = models.CharField(
max_length=10,
choices=FlagChoices.choices,
null=True,
blank=True,
default=None,
verbose_name="标记",
)
class Meta: class Meta:
ordering = ("-created",) ordering = ("-created",)