diff --git a/shiftregister/app/admin.py b/shiftregister/app/admin.py index d712fb4..8863a5c 100644 --- a/shiftregister/app/admin.py +++ b/shiftregister/app/admin.py @@ -3,7 +3,15 @@ from django.contrib.admin import DateFieldListFilter from .models import Room, Shift, Helper, ShiftRegistration, Message, LoginToken -admin.site.register(Room) + +@admin.register(Room) +class RoomAdmin(admin.ModelAdmin): + list_display = ("name", "description_length") + + def description_length(self, object): + if object.description: + return len(object.description) + return 0 @admin.register(Shift)