2
0
Fork 0

add description length to room admin list

This commit is contained in:
Florian Sorg 2023-05-07 00:19:56 +02:00
parent 5ce4c44b6a
commit 56d4202b56
1 changed files with 9 additions and 1 deletions

View File

@ -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)