From 443b6fc81f60ea151d2c6f98509e75153caf5c87 Mon Sep 17 00:00:00 2001 From: Sanj Date: Tue, 5 Jul 2011 18:16:30 +0530 Subject: [PATCH] try to fix weird issue with cropped files missing --- edgware/editor/models.py | 8 +++++++- edgware/files/models.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/edgware/editor/models.py b/edgware/editor/models.py index 7163530..826ba37 100644 --- a/edgware/editor/models.py +++ b/edgware/editor/models.py @@ -727,7 +727,13 @@ class ImageBox(models.Model): else: m = 1 path = join(MEDIA_ROOT, self.actual_unresized()) - f = open(path) + + 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) ''' diff --git a/edgware/files/models.py b/edgware/files/models.py index dabcbc5..e560186 100755 --- a/edgware/files/models.py +++ b/edgware/files/models.py @@ -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')