from django.contrib import admin
from .models import Lesson, LessonEnrollment

@admin.register(Lesson)
class LessonAdmin(admin.ModelAdmin):
    list_display = ('course', 'instructor', 'date', 'start_time', 'end_time', 'location', 'max_students', 'created_at', 'updated_at')
    list_filter = ('date', 'created_at', 'updated_at')
    search_fields = ('course__title', 'instructor__profile__user__username', 'location')
    date_hierarchy = 'date'

@admin.register(LessonEnrollment)
class LessonEnrollmentAdmin(admin.ModelAdmin):
    list_display = ('lesson', 'student', 'created_at')
    list_filter = ('created_at',)
    search_fields = ('lesson__course__title', 'student__profile__user__username') 