add description length to room admin list

pull/1/head
Florian Sorg 2 years ago
parent 5ce4c44b6a
commit 56d4202b56

@ -3,7 +3,15 @@ from django.contrib.admin import DateFieldListFilter
from .models import Room, Shift, Helper, ShiftRegistration, Message, LoginToken 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) @admin.register(Shift)

Loading…
Cancel
Save