Python Shell下更新數(shù)據(jù)
1. 進(jìn)入shell python manage.py shell
2. 更新數(shù)據(jù):
1. 導(dǎo)入model
from exams.models import MatchTestApply
2. 過濾后更新 (根據(jù)自己業(yè)務(wù)更改過濾條件和更新條件)
MatchTestApply.objects.filter(matched_score=None).update(matched_score=-1)
3. 會輸出更改行數(shù)
4. 退出shell:`exit()` 回車