django 모델 데이터 형식 예
__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 = (,)
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
MySQL 에서 Create Index 메 인 키 Primary Key 를 만 들 수 있 습 니까?텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.