This commit is contained in:
j 2011-08-06 09:17:35 +02:00
parent 8f5446e46b
commit 1318d52cb0

View file

@ -217,10 +217,8 @@ class Item(models.Model):
data['summary'] = data.pop('plot') data['summary'] = data.pop('plot')
if 'cast' in data: if 'cast' in data:
if isinstance(data['cast'][0], basestring): if isinstance(data['cast'][0], basestring):
data['actor'] = [data['cast'][0]] data['cast'] = [data['cast']]
else:
data['actor'] = [c[0] for c in data['cast']] data['actor'] = [c[0] for c in data['cast']]
data['actor'] = data['actor']
data['cast'] = map(lambda x: {'actor': x[0], 'character': x[1]}, data['cast']) data['cast'] = map(lambda x: {'actor': x[0], 'character': x[1]}, data['cast'])
if 'trivia' in data: if 'trivia' in data:
def fix_links(t): def fix_links(t):
@ -439,6 +437,8 @@ class Item(models.Model):
if 'reviews' in i: if 'reviews' in i:
i['reviews'] = self.reviews() i['reviews'] = self.reviews()
if 'cast' in i and isinstance(i['cast'][0], basestring):
i['cast'] = [i['cast']]
if 'cast' in i and isinstance(i['cast'][0], list): if 'cast' in i and isinstance(i['cast'][0], list):
i['cast'] = map(lambda x: {'actor': x[0], 'character': x[1]}, i['cast']) i['cast'] = map(lambda x: {'actor': x[0], 'character': x[1]}, i['cast'])