0
我有一個Django應用程序這個看似簡單的測試情況下,失敗:爲什麼我的django模型沒有保存?
def test_matches(self):
# setup code...
matches = tournament.match_set.order_by('match_id')
matches[0].winner = 'a'
matches[0].save()
self.assertEqual(matches[0].winner, 'a')
什麼問題?
https://docs.djangoproject.com/en/1.8/ref/models/querysets/#when-querysets-are-evaluated – Wtower