admin.py
链接
from django.contrib import admin
from PPDASH.models import *
from django.db import models
class EmployeeAdmin(admin.ModelAdmin):
list_display = ('dept_code','level','function','eid', 'name','score_jieshoufankui','score_xueximinruidu',
'score_jieguodaoxiang','score_quanjusiwei','score_shiyingli','score_chengjiutaren','score_lingdaoyiyuan',
'score_pinghengrenjiyurenwu','score_fudao','score_shouquanweize','score_jianlichenggongtuandui',
'score_guanlirenjiguanxi','score_yingxiangli','score_jianlihuobanguanxi','score_jihuayuzuzhi',
)
ordering = ['dept_code']
search_fields = ('dept_code','eid','name',)
list_display_links = ('dept_code','eid','name',)
list_per_page = 10
site_header = "PP结果管理系统"
from .utils import import_employee
class ImportEmployeeFileAdmin(admin.ModelAdmin):
list_display = ('file','name',)
list_filter = ['name',]
def save_model(self, request, obj, form, change):
re = super(ImportEmployeeFileAdmin,self).save_model(request, obj, form, change)
import_employee(self, request, obj, change)
return re
admin.site.register(Employee,EmployeeAdmin)
admin.site.register(Import_Employee,ImportEmployeeFileAdmin)
admin.site.site_header = "PP结果管理系统"
|