195 lines
6.8 KiB
Python
195 lines
6.8 KiB
Python
# Generated by Django 6.0.5 on 2026-05-24 22:37
|
|
|
|
import django.db.models.deletion
|
|
import submissions.models
|
|
import uuid
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
initial = True
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="Submission",
|
|
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)),
|
|
(
|
|
"notes",
|
|
models.TextField(
|
|
blank=True,
|
|
help_text="Optional notes about the submission",
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="User who made the submission (null for anonymous)",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="submissions",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"abstract": False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="SubmissionFile",
|
|
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)),
|
|
(
|
|
"file",
|
|
models.FileField(
|
|
help_text="Uploaded file",
|
|
upload_to=submissions.models.submission_file_upload_path,
|
|
),
|
|
),
|
|
(
|
|
"original_filename",
|
|
models.CharField(
|
|
help_text="Original filename as uploaded by user",
|
|
max_length=255,
|
|
),
|
|
),
|
|
(
|
|
"file_size",
|
|
models.PositiveIntegerField(help_text="File size in bytes"),
|
|
),
|
|
(
|
|
"content_type",
|
|
models.CharField(help_text="MIME type of the file", max_length=100),
|
|
),
|
|
(
|
|
"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.TextField(
|
|
blank=True, help_text="Raw OCR data for the entire file"
|
|
),
|
|
),
|
|
(
|
|
"submission",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="files",
|
|
to="submissions.submission",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Submission File",
|
|
"verbose_name_plural": "Submission Files",
|
|
"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"],
|
|
},
|
|
),
|
|
]
|