Created
June 12, 2011 21:47
-
-
Save milin/1022025 to your computer and use it in GitHub Desktop.
Image model
This file contains 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
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