From 6f229048ddd8c7347ff60dddfb9121e6021c7b2e Mon Sep 17 00:00:00 2001 From: Attila Tovt Date: Sat, 5 Dec 2015 03:14:46 +0200 Subject: Fixed #25547 -- Made Model.refresh_from_db() update FileField's instance. --- tests/model_fields/tests.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/model_fields') diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index 34793eacdb..77361fae79 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -792,6 +792,11 @@ class FileFieldTests(unittest.TestCase): except OSError: self.fail("Deleting an unset FileField should not raise OSError.") + def test_refresh_from_db(self): + d = Document.objects.create(myfile='something.txt') + d.refresh_from_db() + self.assertIs(d.myfile.instance, d) + class BinaryFieldTests(test.TestCase): binary_data = b'\x00\x46\xFE' -- cgit v1.3