try to fix weird issue with cropped files missing

This commit is contained in:
Sanj 2011-07-05 18:16:30 +05:30
parent 692285848d
commit 443b6fc81f
2 changed files with 8 additions and 2 deletions

View File

@ -727,7 +727,13 @@ class ImageBox(models.Model):
else:
m = 1
path = join(MEDIA_ROOT, self.actual_unresized())
try:
f = open(path)
except:
self.crop(self.x1, self, y1, self.x2, self.y2, self.width, self.height)
f = open(path)
size = str(int(self.width * m)) + "x" + str(int(self.height * m))
im = get_thumbnail(f, size, crop='center', quality=99)
'''

View File

@ -92,7 +92,7 @@ class File(models.Model):
tags = TagField("Tags", help_text="Enter as many tags as you like, separated by commas")
userID = models.ForeignKey(User)
file_date = models.DateField("Date", blank=True, null=True)
added = models.DateField("Date Added", auto_now_add=True)
added = models.DateTimeField("Date Added", auto_now_add=True)
categories = models.ManyToManyField('Category', verbose_name='Studies')
private = models.BooleanField(default=False)
# type = models.ForeignKey('Type', verbose_name='File Type')