default to 0

This commit is contained in:
j 2014-02-24 17:17:39 +05:30
parent 71c59e3217
commit bc4969434c

View file

@ -155,6 +155,8 @@ class Imdb(models.Model):
if 'votes' in data: if 'votes' in data:
max_votes = ox.web.imdb.max_votes() max_votes = ox.web.imdb.max_votes()
data['votes'] = 100 * float(data['votes']) / max_votes data['votes'] = 100 * float(data['votes']) / max_votes
else:
data['votes'] = 0
if 'reviews' in data: if 'reviews' in data:
reviews = [] reviews = []
@ -170,8 +172,8 @@ class Imdb(models.Model):
del data['reviews'] del data['reviews']
if 'posterId' in data: if 'posterId' in data:
del data['posterId'] del data['posterId']
data['likes'] = self.info('likes') data['likes'] = self.info('likes', 0)
data['downloads'] = self.info('downloads') data['downloads'] = self.info('downloads', 0)
data['links'] = self.links() data['links'] = self.links()
data['posters'] = self.posters(request) data['posters'] = self.posters(request)
if 'title' in data: if 'title' in data: