Commit c5b73973 authored by Bruno Martin's avatar Bruno Martin
Browse files

add course django admin

parent 07fb3eab
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.forms import Textarea
from django.db import models
# from ..activities.admin import ModelAdmin
from .videos.models import Video
from .models import (
Course, Lesson, Unit, CourseProfessor, CourseStudent,
StudentProgress, Class,
class LessonInline(admin.TabularInline):
model = Lesson
formfield_overrides = {
models.CharField: {'widget': Textarea(attrs={'rows': 3, 'class': 'span11'})},
class CourseAdmin(admin.ModelAdmin):
list_display = ('name', 'status', 'start_date',)
inlines = (LessonInline,)
class UnitInline(admin.TabularInline):
model = Unit
fields = ('title', 'video', 'position',)
class LessonAdmin(admin.ModelAdmin):
list_display = ('name', 'course',)
search_fields = ('course__name',)
inlines = (UnitInline,)
class UnitAdmin(admin.ModelAdmin):
search_fields = ('title', 'lesson__name')
list_display = ('title', 'position', 'lesson', 'video',)
list_select_related = ('lesson', 'video')
class CourseProfessorAdmin(admin.ModelAdmin):
list_display = ('user', 'course',)
class VideoAdmin(admin.ModelAdmin):
class ClassAdmin(admin.ModelAdmin):
search_fields = ('name', 'course', 'assistants')
list_display = ('name', 'course')
filter_horizontal = ('students', )
class StudentProgressAdmin(admin.ModelAdmin):
search_fields = ('user__username', 'user__email', )
list_display = ('user', 'unit', 'complete', 'last_access')
class CourseStudentAdmin(admin.ModelAdmin):
search_fields = ('user__username',)
list_display = ('user', 'course')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment