dont fail if sort is not set

This commit is contained in:
j 2012-10-06 13:59:33 +02:00
parent 0d21708ce1
commit 5bd36539f0

View file

@ -506,8 +506,12 @@ class Item(models.Model):
if key not in i: if key not in i:
value = self.get(key) value = self.get(key)
#also get values from sort table, i.e. numberof values #also get values from sort table, i.e. numberof values
if not value and self.sort and hasattr(self.sort, key): if not value:
value = getattr(self.sort, key) try:
if self.sort and hasattr(self.sort, key):
value = getattr(self.sort, key)
except ItemSort.DoesNotExist:
pass
if value: if value:
i[key] = value i[key] = value