Code

Ticket #15590: filefield-path-set.diff

File filefield-path-set.diff, 592 bytes (added by simon29, 3 years ago)
Line 
1Index: db/models/fields/files.py
2===================================================================
3--- db/models/fields/files.py   (revision 15792)
4+++ db/models/fields/files.py   (working copy)
5@@ -63,8 +63,12 @@
6     def _get_path(self):
7         self._require_file()
8         return self.storage.path(self.name)
9-    path = property(_get_path)
10 
11+    def _set_path(self, path):
12+        self.__init__(self.instance, self.field, path)
13+
14+    path = property(_get_path, _set_path, _del_file)
15+
16     def _get_url(self):
17         self._require_file()
18         return self.storage.url(self.name)