django 모델 데이터 형식 예

3722 단어 Createimportonline
__future__ unicode_literals
django.core.exceptions ValidationError

django.db models
django.contrib.auth.models User

class_type_choices= ((,),
                     (,,),
                     (,,),
                     )
UserProfile(models.Model):
    user = models.OneToOneField(User)
    name = models.CharField(,=)
    ():
        .name

School(models.Model):
    name = models.CharField(,=,=)
    addr = models.CharField(,=)
    staffs = models.ManyToManyField(,=)
    ():
        .name

Course(models.Model):
    name = models.CharField(,=,=)
    price = models.IntegerField()
    online_price = models.IntegerField()
    brief = models.TextField()
    ():
        .name

ClassList(models.Model):
    course = models.ForeignKey()
    course_type = models.CharField(,=class_type_choices,=)
    semester = models.IntegerField()
    start_date = models.DateField()
    graduate_date = models.DateField(,=,=)
    teachers = models.ManyToManyField(UserProfile,=)


    Meta:
        verbose_name = verbose_name_plural = unique_together = (,,)

Customer(models.Model):
    qq = models.CharField(,=,=)
    name = models.CharField(,=,=,=)
    phone = models.BigIntegerField(,=,=)
    stu_id = models.CharField(,=,=,=)
    source_type = ((,),
                   (,),
                   (,),
                   (,),
                   (,),
                   )
    source = models.CharField(,=, =source_type,=)
    referral_from = models.ForeignKey(,=,=,=,=,=)

    course = models.ForeignKey(Course,=)
    class_type = models.CharField(,=,=class_type_choices)
    customer_note = models.TextField(,=)
    status_choices = ((,),
                      (,),
                      (,),
                      )

    status = models.CharField(,=status_choices,=,=,=)
    consultant = models.ForeignKey(UserProfile,=)
    date = models.DateField(,=)

    class_list = models.ManyToManyField(,=,=)

    ():
        %(.qq,.name )


ConsultRecord(models.Model):
    customer = models.ForeignKey(Customer,=)
    note = models.TextField()
    status_choices = ((,),
                      (,),
                      (,),
                      (,),
                      (,),
                      (,),
                      (,),
                      )
    status = models.IntegerField(,=status_choices,=)

    consultant = models.ForeignKey(UserProfile,=)
    date = models.DateField(,=)

    ():
        %(.customer,.status)

    Meta:
        verbose_name = verbose_name_plural = CourseRecord(models.Model):
    course = models.ForeignKey(ClassList,=)
    day_num = models.IntegerField(,=)
    date = models.DateField(=,=)
    teacher = models.ForeignKey(UserProfile,=)
    ():
        %(.course,.day_num)
    Meta:
        verbose_name = verbose_name_plural = unique_together = (,)

StudyRecord(models.Model):
    course_record = models.ForeignKey(CourseRecord, =)
    student = models.ForeignKey(Customer,=)
    record_choices = ((, ),
                      (,),
                      (,),
                      (,),
                      )
    record = models.CharField(,=record_choices,=,=)
    score_choices = ((, ),
                     (,),
                     (,),
                     (,),
                     (,),
                     (,),
                     (,),
                     (,),
                     (,),
                     (-,),
                     (-,),
                     (-,),
                     )
    score = models.IntegerField(,=score_choices,=-)
    date = models.DateTimeField(=)
    note = models.CharField(,=,=,=)

    ():
        %(.course_record,.student.name,.record,.get_score_display())

    Meta:
        verbose_name = verbose_name_plural = unique_together = (,)

좋은 웹페이지 즐겨찾기