From 7ec7f849093a2aa6076f99386abbf0e060521d17 Mon Sep 17 00:00:00 2001 From: adrian kalaveshi Date: Tue, 18 Sep 2012 01:28:52 -0700 Subject: [PATCH] Fix for alternate storage back-ends. This change replaces attachment.path with uploadedfile.url for compatibility with django-storage. Testing done (django 1.4): - Before the change, I was getting a NotImplementedError exception of "This backend doesn't support absolute paths." - After the change, I'm able to upload attachments to AWS as well as a local file system. --- articles/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/articles/models.py b/articles/models.py index 94ea88d..4d201da 100644 --- a/articles/models.py +++ b/articles/models.py @@ -513,7 +513,7 @@ def filename(self): @property def content_type_class(self): - mt = mimetypes.guess_type(self.attachment.path)[0] + mt = mimetypes.guess_type(self.uploadedfile.url)[0] if mt: content_type = mt.replace('/', '_') else: