From d9a2a7f247f2cb06d395029b4e7f3515f27f0849 Mon Sep 17 00:00:00 2001 From: Sanj Date: Wed, 6 Jul 2011 17:39:59 +0530 Subject: [PATCH] height / width / rounding foobar --- edgware/editor/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/edgware/editor/models.py b/edgware/editor/models.py index c8ccde9..bdef087 100644 --- a/edgware/editor/models.py +++ b/edgware/editor/models.py @@ -104,7 +104,7 @@ class Product(models.Model): def get_view_size(self, width=800): aspect_ratio = self.typ.aspect_ratio width = width + .0 - height = int(width // aspect_ratio) + height = int(round(width / aspect_ratio)) return (int(width), height,) class Video(models.Model): @@ -310,11 +310,12 @@ class Article(models.Model): # product = Product.objects.get(pk=self.product.id) aspect_ratio = self.typ.aspect_ratio width = 800 - height = int(round(800.0 // aspect_ratio)) + height = 800.0 / aspect_ratio return (width, height,) def print_size(self, print_width): - height = print_width / aspect_ratio + aspect_ratio = self.typ.aspect_ratio + height = int(round(print_width / aspect_ratio)) multiplier = print_width / (self.editor_width + .0) return (self.print_width, height, multiplier,)