from django.contrib import admin from django import forms from django.contrib.gis.admin import OSMGeoAdmin from django.contrib.contenttypes.admin import GenericStackedInline from utils.widgets import AdminImageWidget, LGEntryForm from .models import Class, Session, ClassMedia @admin.register(Class) class ClassAdmin(admin.ModelAdmin): list_display = ('title', 'session') search_fields = ['title', 'description'] prepopulated_fields = {"slug": ('title',)} list_filter = ('session',) filter_horizontal = ('uploads',) class Media: js = ('image-loader.js', 'product-loader.js', 'next-prev-links.js') css = { "all": ("my_styles.css",) } @admin.register(Session) class SessionAdmin(admin.ModelAdmin): list_display = ('title','date_start','date_end' ) prepopulated_fields = {"slug": ('title',)} class Media: js = ('image-loader.js', 'product-loader.js', 'next-prev-links.js') css = { "all": ("my_styles.css",) } @admin.register(ClassMedia) class ClassMediaAdmin(admin.ModelAdmin): list_display = ('title','file' ) class Media: js = ('image-loader.js', 'product-loader.js', 'next-prev-links.js') css = { "all": ("my_styles.css",) }