summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2011-01-26 07:46:19 +0000
committerCarl Meyer <carl@oddbird.net>2011-01-26 07:46:19 +0000
commit00e7a571c5737c69bc225ae39d3dca6d0fbfd072 (patch)
tree1d0808d05eeb32ccfa4e7d6558d284d5fb947551 /django
parent80287f1e8a554290faa6a0c31113a9f4eecf7b79 (diff)
Fixed #6456 - Excised FileField file deletion to avoid data loss. Thanks to durdinator for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15321 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/db/models/fields/files.py13
1 files changed, 0 insertions, 13 deletions
diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py
index a65b7cdb4c..aaf1fbb0ec 100644
--- a/django/db/models/fields/files.py
+++ b/django/db/models/fields/files.py
@@ -258,19 +258,6 @@ class FileField(Field):
def contribute_to_class(self, cls, name):
super(FileField, self).contribute_to_class(cls, name)
setattr(cls, self.name, self.descriptor_class(self))
- signals.post_delete.connect(self.delete_file, sender=cls)
-
- def delete_file(self, instance, sender, **kwargs):
- file = getattr(instance, self.attname)
- # If no other object of this type references the file,
- # and it's not the default value for future objects,
- # delete it from the backend.
- if file and file.name != self.default and \
- not sender._default_manager.filter(**{self.name: file.name}):
- file.delete(save=False)
- elif file:
- # Otherwise, just close the file, so it doesn't tie up resources.
- file.close()
def get_directory_name(self):
return os.path.normpath(force_unicode(datetime.datetime.now().strftime(smart_str(self.upload_to))))