- Set up Django 5.2.9 project structure - Add boxes app with Box and BoxType models - Box: alphanumeric ID (max 10 chars) with foreign key to BoxType - BoxType: name and dimensions (width/height/length in mm) - Configure admin interface for both models - Add comprehensive test suite (14 tests)
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
# Generated by Django 5.2.9 on 2025-12-28 12:01
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='BoxType',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=255)),
|
|
('width', models.PositiveIntegerField(help_text='Width in millimeters')),
|
|
('height', models.PositiveIntegerField(help_text='Height in millimeters')),
|
|
('length', models.PositiveIntegerField(help_text='Length in millimeters')),
|
|
],
|
|
options={
|
|
'ordering': ['name'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Box',
|
|
fields=[
|
|
('id', models.CharField(help_text='Alphanumeric identifier (max 10 characters)', max_length=10, primary_key=True, serialize=False)),
|
|
('box_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='boxes', to='boxes.boxtype')),
|
|
],
|
|
options={
|
|
'verbose_name_plural': 'boxes',
|
|
},
|
|
),
|
|
]
|