From 5bd36539f0cd6de42bf44bfe7bfd02bc232d4f79 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 6 Oct 2012 13:59:33 +0200 Subject: [PATCH] dont fail if sort is not set --- pandora/item/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index e4c8124f..70cafc6d 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -506,8 +506,12 @@ class Item(models.Model): if key not in i: value = self.get(key) #also get values from sort table, i.e. numberof values - if not value and self.sort and hasattr(self.sort, key): - value = getattr(self.sort, key) + if not value: + try: + if self.sort and hasattr(self.sort, key): + value = getattr(self.sort, key) + except ItemSort.DoesNotExist: + pass if value: i[key] = value