21 lines
796 B
Python
21 lines
796 B
Python
from django.contrib import admin
|
|
from .models import School, Event, Registration
|
|
|
|
@admin.register(School)
|
|
class SchoolAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'slug', 'created_at')
|
|
prepopulated_fields = {'slug': ('name',)}
|
|
search_fields = ('name',)
|
|
|
|
@admin.register(Event)
|
|
class EventAdmin(admin.ModelAdmin):
|
|
list_display = ('title', 'school', 'event_type', 'start_date', 'is_published')
|
|
list_filter = ('school', 'event_type', 'is_published')
|
|
search_fields = ('title', 'description', 'location')
|
|
date_hierarchy = 'start_date'
|
|
|
|
@admin.register(Registration)
|
|
class RegistrationAdmin(admin.ModelAdmin):
|
|
list_display = ('user', 'event', 'registered_at', 'attended')
|
|
list_filter = ('event', 'attended')
|
|
search_fields = ('user__username', 'event__title') |