Skip to content

Instantly share code, notes, and snippets.

@ishuah
Created November 4, 2013 19:56
Show Gist options
  • Save ishuah/7308314 to your computer and use it in GitHub Desktop.
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
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