From 4b2f8845e7c6ba33ec704a3f6716273e9b0b8e73 Mon Sep 17 00:00:00 2001 From: Sanj Date: Wed, 5 Oct 2011 00:40:38 +0530 Subject: [PATCH] upload to separate folders for each project --- urbstudio/urb/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/urbstudio/urb/models.py b/urbstudio/urb/models.py index 371f0c5..2c754b1 100644 --- a/urbstudio/urb/models.py +++ b/urbstudio/urb/models.py @@ -1,8 +1,13 @@ from django.db import models +from os.path import join + +def project_thumb_path(instance, filename): + return join('project_thumbs', instance.id, filename) + class Project(models.Model): title = models.CharField(max_length=255) - thumb_image = models.ImageField(upload_to='project_thumbs/') + thumb_image = models.ImageField(upload_to=project_thumb_path) size_program = models.TextField(blank=True) design_statement = models.TextField(blank=True) extra_text = models.TextField(blank=True)