- 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)
21 lines
470 B
Python
21 lines
470 B
Python
from django.contrib import admin
|
|
|
|
from .models import Box, BoxType
|
|
|
|
|
|
@admin.register(BoxType)
|
|
class BoxTypeAdmin(admin.ModelAdmin):
|
|
"""Admin configuration for BoxType model."""
|
|
|
|
list_display = ('name', 'width', 'height', 'length')
|
|
search_fields = ('name',)
|
|
|
|
|
|
@admin.register(Box)
|
|
class BoxAdmin(admin.ModelAdmin):
|
|
"""Admin configuration for Box model."""
|
|
|
|
list_display = ('id', 'box_type')
|
|
list_filter = ('box_type',)
|
|
search_fields = ('id',)
|