update models

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

@ -14,7 +14,7 @@
</component>
<component name="NewModuleRootManager">
<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" />
</component>
<component name="TemplatesService">

@ -8,5 +8,14 @@
<jdbc-url>jdbc:mysql://localhost:3306/edu_sys</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</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>
</project>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

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

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

@ -7,8 +7,8 @@ from Student.models import Student
# Create your models here.
class Course(models.Model):
cid = models.AutoField(primary_key=True, verbose_name="课程编号", name="cid")
c_name = models.CharField(max_length=255, verbose_name="课程名称", name="c_name")
type = models.CharField(max_length=128, verbose_name="课程类型", name="c_type")
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", blank=True)
credit = models.IntegerField(verbose_name="课程学分", name="credit")
tid = models.ForeignKey(Teacher, to_field="tid", on_delete=models.CASCADE, name="tid")
@ -28,4 +28,4 @@ class SC(models.Model):
db_table = "sc"
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.
class Teacher(models.Model):
tid = models.AutoField(primary_key=True, verbose_name="教师编号", name="tid")
t_name = models.CharField(max_length=255, verbose_name="教师名称", name="t_name")
sex = models.CharField(max_length=128, verbose_name="教师性别", name="t_sex")
title = models.CharField(max_length=128, verbose_name="教师职称", name="t_title")
education = models.CharField(max_length=128, verbose_name="教师学历", name="t_education")
dept = models.CharField(max_length=128, verbose_name="教师所属院系", name="t_dept")
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", blank=True)
title = models.CharField(max_length=128, verbose_name="教师职称", name="t_title", blank=True)
education = models.CharField(max_length=128, verbose_name="教师学历", name="t_education", blank=True)
dept = models.CharField(max_length=128, verbose_name="教师所属院系", name="t_dept", blank=True)
class Meta:
db_table = "teacher"

Loading…
Cancel
Save