update models

scl-branch
jisyoona 1 year ago
parent 4868713095
commit 3d8be360ef

@ -14,7 +14,7 @@
</component> </component>
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7 (EduSystemServer)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="TemplatesService"> <component name="TemplatesService">

@ -8,5 +8,14 @@
<jdbc-url>jdbc:mysql://localhost:3306/edu_sys</jdbc-url> <jdbc-url>jdbc:mysql://localhost:3306/edu_sys</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir> <working-dir>$ProjectFileDir$</working-dir>
</data-source> </data-source>
<data-source source="LOCAL" name="Django default" uuid="ffb088a0-406e-44b2-aed0-9587474966bf">
<driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize>
<imported>true</imported>
<remarks>$PROJECT_DIR$/EduSystemServer/settings.py</remarks>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1:3306/edu_sys</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component> </component>
</project> </project>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (EduSystemServer)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project> </project>

@ -4,8 +4,8 @@ from django.db import models
class Admin(models.Model): class Admin(models.Model):
username = models.CharField(max_length=32, primary_key=True, name="username", verbose_name="管理员账号") username = models.CharField(max_length=32, primary_key=True, name="username", verbose_name="管理员账号", blank=True)
password = models.CharField(max_length=128, name="password", verbose_name="管理员密码") password = models.CharField(max_length=128, name="password", verbose_name="管理员密码", blank=True)
class Meta: class Meta:
db_table = "Eduadmin" db_table = "Eduadmin"

@ -3,17 +3,18 @@ from django.db import models
# Create your models here. # Create your models here.
class Student(models.Model): class Student(models.Model):
sid = models.IntegerField(primary_key=True, verbose_name="学生编号", name="sid") sid = models.AutoField(primary_key=True, verbose_name="学生编号", name="sid")
username = models.CharField(max_length=30, verbose_name="用户名称", name="s_username") username = models.CharField(max_length=30, verbose_name="用户名称", name="s_username", blank=True)
password = models.CharField(max_length=100, verbose_name="密码", name="s_password") password = models.CharField(max_length=100, verbose_name="密码", name="s_password", blank=True)
s_name = models.CharField(max_length=100, verbose_name="姓名", name="s_name") s_name = models.CharField(max_length=100, verbose_name="姓名", name="s_name", blank=True)
sex = models.CharField(max_length=4, verbose_name="性别", name="s_sex") sex = models.CharField(max_length=4, verbose_name="性别", name="s_sex", blank=True)
grade = models.IntegerField(verbose_name="年级", name="s_grade") grade = models.CharField(max_length=20, verbose_name="年级", name="s_grade", blank=True)
class_name = models.CharField(max_length=50, verbose_name="班级", name="s_class_name") class_name = models.CharField(max_length=50, verbose_name="班级", name="s_class_name", blank=True)
major = models.CharField(max_length=50, verbose_name="专业名称", name="s_major") major = models.CharField(max_length=50, verbose_name="专业名称", name="s_major", blank=True)
def to_dict(self): def to_dict(self):
return {"sid": self.sid, "s_name": self.s_name} return {"sid": self.sid, "s_name": self.s_name, "username": self.username, "password": self.password,
"s_sex": self.sex, "s_grade": self.grade, "class_name": self.class_name, "major": self.major}
class Meta: class Meta:
db_table = "student" db_table = "student"

@ -7,8 +7,8 @@ from Student.models import Student
# Create your models here. # Create your models here.
class Course(models.Model): class Course(models.Model):
cid = models.AutoField(primary_key=True, verbose_name="课程编号", name="cid") cid = models.AutoField(primary_key=True, verbose_name="课程编号", name="cid")
c_name = models.CharField(max_length=255, verbose_name="课程名称", name="c_name") c_name = models.CharField(max_length=255, verbose_name="课程名称", name="c_name", blank=True)
type = models.CharField(max_length=128, verbose_name="课程类型", name="c_type") type = models.CharField(max_length=128, verbose_name="课程类型", name="c_type", blank=True)
credit = models.IntegerField(verbose_name="课程学分", name="credit") credit = models.IntegerField(verbose_name="课程学分", name="credit")
tid = models.ForeignKey(Teacher, to_field="tid", on_delete=models.CASCADE, name="tid") tid = models.ForeignKey(Teacher, to_field="tid", on_delete=models.CASCADE, name="tid")
@ -28,4 +28,4 @@ class SC(models.Model):
db_table = "sc" db_table = "sc"
verbose_name = "管理员" verbose_name = "管理员"
verbose_name_plural = verbose_name verbose_name_plural = verbose_name
unique_together = ("sid", "cid") unique_together = ("sid", "cid")

@ -4,11 +4,11 @@ from django.db import models
# Create your models here. # Create your models here.
class Teacher(models.Model): class Teacher(models.Model):
tid = models.AutoField(primary_key=True, verbose_name="教师编号", name="tid") tid = models.AutoField(primary_key=True, verbose_name="教师编号", name="tid")
t_name = models.CharField(max_length=255, verbose_name="教师名称", name="t_name") t_name = models.CharField(max_length=255, verbose_name="教师名称", name="t_name", blank=True)
sex = models.CharField(max_length=128, verbose_name="教师性别", name="t_sex") sex = models.CharField(max_length=128, verbose_name="教师性别", name="t_sex", blank=True)
title = models.CharField(max_length=128, verbose_name="教师职称", name="t_title") title = models.CharField(max_length=128, verbose_name="教师职称", name="t_title", blank=True)
education = models.CharField(max_length=128, verbose_name="教师学历", name="t_education") education = models.CharField(max_length=128, verbose_name="教师学历", name="t_education", blank=True)
dept = models.CharField(max_length=128, verbose_name="教师所属院系", name="t_dept") dept = models.CharField(max_length=128, verbose_name="教师所属院系", name="t_dept", blank=True)
class Meta: class Meta:
db_table = "teacher" db_table = "teacher"

Loading…
Cancel
Save