|
|
@ -1,4 +1,5 @@
|
|
|
|
from django.contrib import admin
|
|
|
|
from django.contrib import admin
|
|
|
|
|
|
|
|
from django.contrib.admin import DateFieldListFilter
|
|
|
|
|
|
|
|
|
|
|
|
from .models import Room, Shift, Helper, ShiftRegistration, Message, LoginToken
|
|
|
|
from .models import Room, Shift, Helper, ShiftRegistration, Message, LoginToken
|
|
|
|
|
|
|
|
|
|
|
@ -42,6 +43,7 @@ class HelperAdmin(admin.ModelAdmin):
|
|
|
|
@admin.register(ShiftRegistration)
|
|
|
|
@admin.register(ShiftRegistration)
|
|
|
|
class ShiftRegistrationAdmin(admin.ModelAdmin):
|
|
|
|
class ShiftRegistrationAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ("start_at", "room", "helper_name", "state")
|
|
|
|
list_display = ("start_at", "room", "helper_name", "state")
|
|
|
|
|
|
|
|
list_filter = (("shift__start_at", DateFieldListFilter), "shift__room", "state")
|
|
|
|
|
|
|
|
|
|
|
|
def room(self, obj):
|
|
|
|
def room(self, obj):
|
|
|
|
return obj.shift.room.name
|
|
|
|
return obj.shift.room.name
|
|
|
@ -49,6 +51,8 @@ class ShiftRegistrationAdmin(admin.ModelAdmin):
|
|
|
|
def start_at(self, obj):
|
|
|
|
def start_at(self, obj):
|
|
|
|
return obj.shift.start_at
|
|
|
|
return obj.shift.start_at
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start_at.admin_order_field = "shift__start_at"
|
|
|
|
|
|
|
|
|
|
|
|
def helper_name(self, obj):
|
|
|
|
def helper_name(self, obj):
|
|
|
|
return obj.helper.name
|
|
|
|
return obj.helper.name
|
|
|
|
|
|
|
|
|
|
|
|