Created
November 4, 2013 19:56
-
-
Save ishuah/7308314 to your computer and use it in GitHub Desktop.
How to implement https://github.com/kienluu/blobstore_storage in your django models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from blobstore_storage.storage import BlobStoreStorage | |
class Image(models.Model): | |
image = models.ImageField( | |
storage=BlobStoreStorage(), upload_to='board_pics/', max_length=255) | |
def __unicode__(self): | |
index = self.image.name.find('/') | |
if index > -1: | |
return self.image.name[index + 1:] | |
return self.image.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment