Skip to content

Commit

Permalink
Add url property to BlobStoreFile and BlobstoreUploadedFile.
Browse files Browse the repository at this point in the history
This makes the FileField's ClearableFileInput widget show up properly when there's an existing file in the model.
  • Loading branch information
projecteat committed Mar 16, 2013
1 parent 6bca0c5 commit 6a472a8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions djangoappengine/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ def file(self):
self._file = BlobReader(self.blobstore_info.key())
return self._file

@property
def url(self):
try:
return get_serving_url(self.blobstore_info.key())
except NotImageError:
return None


class BlobstoreFileUploadHandler(FileUploadHandler):
"""
Expand Down Expand Up @@ -197,3 +204,10 @@ def chunks(self, chunk_size=1024 * 128):

def multiple_chunks(self, chunk_size=1024 * 128):
return True

@property
def url(self):
try:
return get_serving_url(self.blobstore_info.key())
except NotImageError:
return None

0 comments on commit 6a472a8

Please sign in to comment.