init medical training project
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||
from .models import User, Role, TeacherStudentRelation, Institution, Department
|
||||
|
||||
|
||||
@admin.register(User)
|
||||
class UserAdmin(BaseUserAdmin):
|
||||
list_display = [
|
||||
'id', 'username', 'real_name', 'phone', 'role_type',
|
||||
'institution', 'department', 'current_level',
|
||||
'total_training_count', 'status', 'last_login_time', 'created_at'
|
||||
]
|
||||
list_filter = ['role_type', 'status', 'gender', 'created_at']
|
||||
search_fields = ['username', 'real_name', 'phone']
|
||||
ordering = ['-created_at']
|
||||
fieldsets = (
|
||||
(None, {'fields': ('username', 'password')}),
|
||||
('个人信息', {'fields': (
|
||||
'real_name', 'phone', 'avatar', 'gender',
|
||||
'title_name', 'major', 'training_stage'
|
||||
)}),
|
||||
('机构信息', {'fields': (
|
||||
'institution', 'department', 'role_type'
|
||||
)}),
|
||||
('能力数据', {'fields': (
|
||||
'competency_profile', 'weak_dimensions', 'strong_dimensions',
|
||||
'learning_target', 'current_level',
|
||||
'total_training_count', 'total_case_count'
|
||||
)}),
|
||||
('AI偏好', {'fields': ('ai_preference',)}),
|
||||
('状态', {'fields': ('status', 'last_login_time', 'is_staff', 'is_superuser')}),
|
||||
)
|
||||
add_fieldsets = (
|
||||
(None, {
|
||||
'classes': ('wide',),
|
||||
'fields': ('username', 'password1', 'password2', 'real_name', 'role_type'),
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
@admin.register(Role)
|
||||
class RoleAdmin(admin.ModelAdmin):
|
||||
list_display = ['id', 'role_code', 'role_name']
|
||||
search_fields = ['role_code', 'role_name']
|
||||
|
||||
|
||||
@admin.register(TeacherStudentRelation)
|
||||
class TeacherStudentRelationAdmin(admin.ModelAdmin):
|
||||
list_display = ['id', 'teacher', 'student', 'relation_type', 'status', 'start_time']
|
||||
list_filter = ['relation_type', 'status']
|
||||
search_fields = ['teacher__real_name', 'student__real_name']
|
||||
|
||||
|
||||
@admin.register(Institution)
|
||||
class InstitutionAdmin(admin.ModelAdmin):
|
||||
list_display = ['id', 'name', 'type', 'level', 'province', 'city']
|
||||
list_filter = ['type', 'province']
|
||||
search_fields = ['name']
|
||||
|
||||
|
||||
@admin.register(Department)
|
||||
class DepartmentAdmin(admin.ModelAdmin):
|
||||
list_display = ['id', 'name', 'institution', 'category']
|
||||
list_filter = ['category']
|
||||
search_fields = ['name', 'institution__name']
|
||||
Reference in New Issue
Block a user