from django.contrib import admin from .models import LockerBank, LockerRental, LockerUnit class LockerUnitInline(admin.TabularInline): model = LockerUnit extra = 0 @admin.register(LockerBank) class LockerBankAdmin(admin.ModelAdmin): inlines = [LockerUnitInline] prepopulated_fields = {"slug": ("name",)} class LockerRentalInline(admin.TabularInline): model = LockerRental extra = 0 @admin.register(LockerUnit) class LockerUnitAdmin(admin.ModelAdmin): inlines = [LockerRentalInline] admin.site.register(LockerRental)