Django体能测试成绩管理平台之学生基本信息APP
- 《我为何又开始用Django了(内含安装和配置超详细文档)》
- 《Django体能测试成绩管理平台之环境和服务器准备》
- 《Django体能测试成绩管理平台之xadmin安装》
- 《Django体能测试成绩管理平台之学生基本信息APP》
创建体能测试app
django-admin startapp TiCeApp
学生基本信息
#encoding: utf-8
from django.db import models
from django.utils.translation import ugettext_lazy as _
import datetime
class StuBase(models.Model):
xjh = models.CharField(_(u'学籍号'),max_length=30,primary_key=True)
minzuCode = models.CharField(_(u'民族代码'),max_length=50)
name = models.CharField(_(u'姓名'),max_length=30)
sex= models.CharField(_(u'性别'),max_length=50)
birth = models.CharField(_(u'出生日期'),max_length=40, blank=True)
home = models.CharField(_(u'家庭住址'),max_length=40, blank=True)
class Meta:
verbose_name = u"学生基础信息"
verbose_name_plural = verbose_name
adminx.py
# encoding: utf-8
import xadmin
from xadmin import views
import datetime
from .models import *
class StuBaseAdmin(object):
list_display = ('xjh','minzuCode','name','sex','birth' ,'home',)
list_display_links = ('xjh','name',)
list_filter=('xjh','minzuCode','name','sex','birth',)
reversion_enable = True
search_fields = ['xjh','minzuCode','name','sex','birth',]
xadmin.site.register(StuBase, StuBaseAdmin)
网友评论