from django.contrib import admin

from .models import LeveeWorkSession, LeveeWorkSessionItem


class LeveeWorkSessionItemInline(admin.TabularInline):
    model = LeveeWorkSessionItem
    extra = 0


@admin.register(LeveeWorkSession)
class LeveeWorkSessionAdmin(admin.ModelAdmin):
    list_display = ['date', 'title', 'year', 'created_at']
    list_filter = ['year', 'date']
    search_fields = ['title', 'items__field__name']
    inlines = [LeveeWorkSessionItemInline]

