Online Classroom

First, the functional requirements analysis

  1 / Analysis

  Storage, transcoding, encryption; individual separate development, unrealistic

  2 / Function

  Video display a list of page

  Video playback details

Second, the model design

  1. Field analysis

    a, teacher table

      Full name

      job title

      Brief introduction

      Head portrait

    b, curriculum classification

      name

    c, curriculum

      course name

      Front cover

      Video address

      Course duration

      Course Description

      Course Outline

       teacher

      classification

    2. The model definition

 

It is defined in the following model course / models.py in

  

from django.db import models

 

from utils.models import BaseModel

 

 

class Teacher(BaseModel):

    name = models.CharField ( 'name lecturer', max_length = 150, help_text = 'Instructor Name')

    title = models.CharField ( 'title', max_length = 150, help_text = 'title')

    profile = models.TextField ( 'Profile', help_text = 'Profile')

    photo = models.URLField ( 'head url', default = '', help_text = 'avatar url')

 

    class Meta:

        db_table = 'tb_teachers'

        verbose_name = 'Lecturer'

        verbose_name_plural = verbose_name

 

    def __str__(self):

        return self.name

 

 

class CourseCategory(BaseModel):

    name = models.CharField ( 'Course category name', max_length = 100, help_text = 'Course categories name')

 

    class Meta:

        db_table = 'tb_course_category'

        verbose_name = 'Course categories'

        verbose_name_plural = verbose_name

 

    def __str__(self):

        return self.name

 

 

class Course(BaseModel):

    title = models.CharField ( 'program name', max_length = 150, help_text = 'program name')

    cover_url = models.URLField ( 'cover url', help_text = 'covers url')

    video_url = models.URLField ( 'video program url', help_text = 'Course video url')

    duration = models.DurationField ( 'Course Length', help_text = 'Course Length')

    profile = models.TextField ( 'Course Description', null = True, blank = True, help_text = 'Course Description')

    outline = models.TextField ( 'course outline', null = True, blank = True, help_text = 'syllabus')

    teacher = models.ForeignKey('Teacher', on_delete=models.SET_NULL, null=True, blank=True)

    category = models.ForeignKey('CourseCategory', on_delete=models.SET_NULL, null=True, blank=True)

 

    class Meta:

        db_table = 'tb_course'

        verbose_name = 'Course'

        verbose_name_plural = verbose_name

 

    def __str__(self):

        return self.title

 

 

 

      

 

Guess you like

Origin www.cnblogs.com/wdty/p/11415024.html