146 lines
5.0 KiB
Python
146 lines
5.0 KiB
Python
|
|
from django import forms
|
|
from .models import EcUser, ContactInfo, SchoolInfo, AcademicInfo, HealthInfo, SelfEvaluation
|
|
from .models import HobbiesInterests, SocialPractice, FamilyInfo, AwardsPunishments
|
|
|
|
class BaiscInfoForm(forms.ModelForm):
|
|
class Meta:
|
|
model = EcUser
|
|
fields = ['name', 'gender', 'age', 'ethnicity', 'dob', 'id_card_number', 'political_status']
|
|
|
|
class ContactInfoForm(forms.ModelForm):
|
|
class Meta:
|
|
model = ContactInfo
|
|
fields = ['home_address', 'parent_contact', 'student_contact', 'email']
|
|
labels = {
|
|
'home_address': '家庭住址',
|
|
'parent_contact': '家长联系方式',
|
|
'student_contact': '学生联系方式',
|
|
'email': '电子邮箱',
|
|
}
|
|
|
|
# SchoolInfo 表单
|
|
class SchoolInfoForm(forms.ModelForm):
|
|
class Meta:
|
|
model = SchoolInfo
|
|
fields = ['school_name', 'grade', 'class_name', 'admission_date', 'expected_graduation_date']
|
|
labels = {
|
|
'school_name': '学校名称',
|
|
'grade': '年级',
|
|
'class_name': '班级名称',
|
|
'admission_date': '入学日期',
|
|
'expected_graduation_date': '预计毕业日期',
|
|
}
|
|
|
|
# AcademicInfo 表单
|
|
class AcademicInfoForm(forms.ModelForm):
|
|
class Meta:
|
|
model = AcademicInfo
|
|
fields = ['last_semester_score', 'this_semester_score', 'class_ranking', 'strong_subject', 'weak_subject']
|
|
labels = {
|
|
'last_semester_score': '上学期成绩',
|
|
'this_semester_score': '本学期成绩',
|
|
'class_ranking': '班级排名',
|
|
'strong_subject': '优势科目',
|
|
'weak_subject': '弱势科目',
|
|
}
|
|
|
|
# HealthInfo 表单
|
|
class HealthInfoForm(forms.ModelForm):
|
|
class Meta:
|
|
model = HealthInfo
|
|
fields = ['height', 'weight', 'blood_type', 'medical_history', 'disability_status', 'disability_category', 'disability_grade']
|
|
labels = {
|
|
'height': '身高',
|
|
'weight': '体重',
|
|
'blood_type': '血型',
|
|
'medical_history': '病史',
|
|
'disability_status': '残疾情况',
|
|
'disability_category': '残疾类别',
|
|
'disability_grade': '残疾等级',
|
|
}
|
|
# SelfEvaluation 表单
|
|
class SelfEvaluationForm(forms.ModelForm):
|
|
class Meta:
|
|
model = SelfEvaluation
|
|
fields = ['strengths', 'weaknesses', 'study_attitude', 'future_plans']
|
|
labels = {
|
|
'strengths': '优点',
|
|
'weaknesses': '缺点',
|
|
'study_attitude': '学习态度',
|
|
'future_plans': '未来计划',
|
|
}
|
|
|
|
# HobbiesInterests 表单
|
|
class HobbiesInterestsForm(forms.ModelForm):
|
|
class Meta:
|
|
model = HobbiesInterests
|
|
fields = ['interests', 'extracurricular_activities']
|
|
labels = {
|
|
'interests': '兴趣爱好',
|
|
'extracurricular_activities': '课外活动',
|
|
}
|
|
|
|
# SocialPractice 表单
|
|
class SocialPracticeForm(forms.ModelForm):
|
|
class Meta:
|
|
model = SocialPractice
|
|
fields = ['activity_name', 'activity_date', 'activity_location', 'activity_description', 'activity_outcome']
|
|
labels = {
|
|
'activity_name': '活动名称',
|
|
'activity_date': '活动日期',
|
|
'activity_location': '活动地点',
|
|
'activity_description': '活动描述',
|
|
'activity_outcome': '活动成果',
|
|
}
|
|
|
|
# FamilyInfo 表单
|
|
class FamilyInfoForm(forms.ModelForm):
|
|
class Meta:
|
|
model = FamilyInfo
|
|
fields = ['family_member', 'economic_status']
|
|
labels = {
|
|
'family_member': '家庭成员',
|
|
'economic_status': '经济状况',
|
|
}
|
|
|
|
# AwardsPunishments 表单
|
|
class AwardsPunishmentsForm(forms.ModelForm):
|
|
class Meta:
|
|
model = AwardsPunishments
|
|
fields = ['award_name', 'award_date', 'award_organization', 'discipline_date', 'discipline_issue', 'discipline_outcome']
|
|
labels = {
|
|
|
|
'award_name': '奖项名称',
|
|
'award_date': '获奖日期',
|
|
'award_organization': '颁奖机构',
|
|
'discipline_date': '处分日期',
|
|
'discipline_issue': '处分问题',
|
|
'discipline_outcome': '处分结果',
|
|
}
|
|
|
|
# 获取或创建各个信息模型实例
|
|
g_models = {
|
|
'contact_info': ContactInfo,
|
|
'school_info': SchoolInfo,
|
|
'academic_info': AcademicInfo,
|
|
'health_info': HealthInfo,
|
|
'self_evaluation': SelfEvaluation,
|
|
'hobbies_interests': HobbiesInterests,
|
|
'social_practice': SocialPractice,
|
|
'family_info': FamilyInfo,
|
|
'awards_punishments': AwardsPunishments
|
|
}
|
|
|
|
g_form_classes = {
|
|
'contact_info_form': ContactInfoForm,
|
|
'school_info_form': SchoolInfoForm,
|
|
'academic_info_form': AcademicInfoForm,
|
|
'health_info_form': HealthInfoForm,
|
|
'self_evaluation_form': SelfEvaluationForm,
|
|
'hobbies_interests_form': HobbiesInterestsForm,
|
|
'social_practice_form': SocialPracticeForm,
|
|
'family_info_form': FamilyInfoForm,
|
|
'awards_punishments_form': AwardsPunishmentsForm
|
|
}
|