记录一下:
if request.method == 'GET':
obj = models.Clasz.objects.filter(id=cid).first()
cls_dean_id = obj.classdean.id
print('================>', obj.classdean.id)
id_list = obj.teacher.values_list('id')
teacher_id = [index[0] for index in id_list]
form = customforms.Clasz(
initial={'name': obj.name, 'teacher': teacher_id, 'classdean': cls_dean_id})
return render(request, 'editclasz.html', {'form': form})