Skip to content

Instantly share code, notes, and snippets.

@milin
Created June 12, 2011 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milin/1022025 to your computer and use it in GitHub Desktop.
Save milin/1022025 to your computer and use it in GitHub Desktop.
Image model
import os
from autoslug import AutoSlugField
def issue_screenshot_path(screenshots,filename):
'''
Returns the filepath where the screenshot of this issue is store.
'''
return os.path.join('qa/issue/screenshots', '%s' %(screenshots.slug,))
class Image(models.Model):
app = models.ForeignKey(App, unique = False)
slug = AutoSlugField(max_length=255, unique=True, populate_from='app')
image = models.ImageField(blank = True, null = True,
upload_to=issue_screenshot_path,max_length = 255)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment