2022-01-24 22:03:10 -05:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2022-01-27 14:55:27 -05:00
|
|
|
from .models import LockerBank, LockerRental, LockerUnit
|
2022-01-24 22:03:10 -05:00
|
|
|
|
2022-01-24 23:37:04 -05:00
|
|
|
|
2022-01-27 14:55:27 -05:00
|
|
|
class LockerUnitInline(admin.TabularInline):
|
|
|
|
model = LockerUnit
|
2022-01-24 22:03:10 -05:00
|
|
|
extra = 0
|
|
|
|
|
2022-01-24 23:37:04 -05:00
|
|
|
|
2022-01-24 22:03:10 -05:00
|
|
|
@admin.register(LockerBank)
|
|
|
|
class LockerBankAdmin(admin.ModelAdmin):
|
2022-01-27 14:55:27 -05:00
|
|
|
inlines = [LockerUnitInline]
|
2022-01-24 22:03:10 -05:00
|
|
|
prepopulated_fields = {"slug": ("name",)}
|
|
|
|
|
2022-01-24 23:37:04 -05:00
|
|
|
|
2022-01-27 14:55:27 -05:00
|
|
|
class LockerRentalInline(admin.TabularInline):
|
|
|
|
model = LockerRental
|
|
|
|
extra = 0
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(LockerUnit)
|
|
|
|
class LockerUnitAdmin(admin.ModelAdmin):
|
|
|
|
inlines = [LockerRentalInline]
|
|
|
|
|
|
|
|
|
2022-01-28 16:03:58 -05:00
|
|
|
@admin.register(LockerRental)
|
|
|
|
class LockerRentalAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ["user__username", "locker_unit__bank__name"]
|