2022-01-24 22:03:10 -05:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2022-02-16 16:06:51 -05:00
|
|
|
from .models import LockerBank, LockerInfo, LockerUnit
|
|
|
|
|
|
|
|
|
|
|
|
class LockerInfoInline(admin.TabularInline):
|
|
|
|
model = LockerInfo
|
|
|
|
extra = 0
|
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
|
|
|
@admin.register(LockerUnit)
|
|
|
|
class LockerUnitAdmin(admin.ModelAdmin):
|
2022-02-16 16:06:51 -05:00
|
|
|
inlines = [LockerInfoInline]
|
2022-01-27 14:55:27 -05:00
|
|
|
|
|
|
|
|
2022-02-16 16:06:51 -05:00
|
|
|
@admin.register(LockerInfo)
|
|
|
|
class LockerInfoAdmin(admin.ModelAdmin):
|
|
|
|
search_fields = ["renter__username", "locker_unit__bank__name"]
|
|
|
|
list_filter = ["locker_unit__bank", "locker_unit", "renter"]
|
|
|
|
list_display = ["locker_unit", "address", "blind_code", "bitting_code", "renter"]
|
|
|
|
list_display_links = ["locker_unit", "address"]
|