May 2018
Beginner to intermediate
526 pages
11h 57m
English
Let's add the course models to the administration site. Edit the admin.py file inside the courses application directory and add the following code to it:
from django.contrib import adminfrom .models import Subject, Course, Module@admin.register(Subject)class SubjectAdmin(admin.ModelAdmin): list_display = ['title', 'slug'] prepopulated_fields = {'slug': ('title',)}class ModuleInline(admin.StackedInline): model = Module@admin.register(Course)class CourseAdmin(admin.ModelAdmin): list_display = ['title', 'subject', 'created'] list_filter = ['created', 'subject'] search_fields = ['title', 'overview'] prepopulated_fields = {'slug': ('title',)} inlines = [ModuleInline]
The models for the course application ...
Read now
Unlock full access