|
|
@ -1,8 +1,11 @@
|
|
|
|
from django.contrib import admin
|
|
|
|
from django.contrib import admin
|
|
|
|
from .models import Course, SC
|
|
|
|
from .models import Course, SC
|
|
|
|
|
|
|
|
|
|
|
|
# Register your models here.
|
|
|
|
# Register your models here.
|
|
|
|
|
|
|
|
|
|
|
|
admin.site.site_header = '教务系统管理端'
|
|
|
|
admin.site.site_header = '教务系统管理端'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CourseAdmin(admin.ModelAdmin):
|
|
|
|
class CourseAdmin(admin.ModelAdmin):
|
|
|
|
'''设置列表可显示的字段'''
|
|
|
|
'''设置列表可显示的字段'''
|
|
|
|
list_display = ('cid', 'name', 'type', 'credit', "tid")
|
|
|
|
list_display = ('cid', 'name', 'type', 'credit', "tid")
|
|
|
@ -16,15 +19,16 @@ class CourseAdmin(admin.ModelAdmin):
|
|
|
|
'''设置可编辑字段'''
|
|
|
|
'''设置可编辑字段'''
|
|
|
|
list_editable = ('name', 'type', 'credit', "tid")
|
|
|
|
list_editable = ('name', 'type', 'credit', "tid")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'''按发布日期排序'''
|
|
|
|
'''按发布日期排序'''
|
|
|
|
ordering = ('-credit',)
|
|
|
|
ordering = ('-credit',)
|
|
|
|
|
|
|
|
|
|
|
|
search_fields = ('name', 'type', 'credit', "tid")
|
|
|
|
search_fields = ('name', 'type', 'credit', "tid")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ScAdmin(admin.ModelAdmin):
|
|
|
|
class ScAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('student_name', 'course_name', 'middle_grade', 'end_grade')
|
|
|
|
list_display = ('student_name', 'course_name', 'middle_grade', 'end_grade')
|
|
|
|
list_per_page = 5
|
|
|
|
list_per_page = 5
|
|
|
|
|
|
|
|
|
|
|
|
def student_name(self, obj):
|
|
|
|
def student_name(self, obj):
|
|
|
|
print(obj)
|
|
|
|
print(obj)
|
|
|
|
return obj.sid.name
|
|
|
|
return obj.sid.name
|
|
|
|