feat: add django-channel and daphne

This commit is contained in:
2026-05-25 00:42:34 +02:00
parent f543cdcd5c
commit c2602dbc02
8 changed files with 1158 additions and 43 deletions
@@ -1,4 +1,4 @@
# Generated by Django 5.2.7 on 2026-05-24 21:34
# Generated by Django 6.0.5 on 2026-05-24 22:37
import django.db.models.deletion
import submissions.models
@@ -27,6 +27,8 @@ class Migration(migrations.Migration):
serialize=False,
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"notes",
models.TextField(
@@ -35,8 +37,6 @@ class Migration(migrations.Migration):
null=True,
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"user",
models.ForeignKey(
@@ -49,6 +49,9 @@ class Migration(migrations.Migration):
),
),
],
options={
"abstract": False,
},
),
migrations.CreateModel(
name="SubmissionFile",
@@ -62,6 +65,8 @@ class Migration(migrations.Migration):
serialize=False,
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"file",
models.FileField(
@@ -85,26 +90,25 @@ class Migration(migrations.Migration):
models.CharField(help_text="MIME type of the file", max_length=100),
),
(
"ocr_processed",
models.BooleanField(
default=False,
help_text="Whether OCR has been processed for this file",
"ocr_status",
models.CharField(
choices=[
("to_process", "To Process"),
("processing", "Processing"),
("processed", "Processed"),
("error", "Error processing"),
],
default="to_process",
help_text="OCR processing status for the entire file",
max_length=20,
),
),
(
"ocr_raw_data",
models.JSONField(
blank=True, help_text="Raw OCR data as JSON", null=True
),
),
(
"ocr_error",
models.TextField(
blank=True, help_text="OCR processing error message"
blank=True, help_text="Raw OCR data for the entire file"
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"submission",
models.ForeignKey(
@@ -120,4 +124,71 @@ class Migration(migrations.Migration):
"ordering": ["file", "created_at"],
},
),
migrations.CreateModel(
name="ImageCrop",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
("x1", models.PositiveIntegerField(help_text="Top-left x coordinate")),
("y1", models.PositiveIntegerField(help_text="Top-left y coordinate")),
(
"x2",
models.PositiveIntegerField(help_text="Bottom-right x coordinate"),
),
(
"y2",
models.PositiveIntegerField(help_text="Bottom-right y coordinate"),
),
(
"label",
models.CharField(
blank=True,
help_text="Optional label for this crop region",
max_length=255,
),
),
(
"ocr_status",
models.CharField(
choices=[
("to_process", "To Process"),
("processing", "Processing"),
("processed", "Processed"),
("error", "Error processing"),
],
default="to_process",
help_text="OCR processing status for this crop",
max_length=20,
),
),
(
"ocr_raw_data",
models.TextField(
blank=True, help_text="Raw OCR data for this crop"
),
),
(
"submission_file",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="crops",
to="submissions.submissionfile",
),
),
],
options={
"verbose_name": "Image Crop",
"verbose_name_plural": "Image Crops",
"ordering": ["created_at"],
},
),
]