summaryrefslogtreecommitdiff
path: root/app/classes/admin.py
blob: 5fcca4b0761d22070adaaf4db05e05740b53d5d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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",)
        }