check if cast is in data

This commit is contained in:
j 2011-01-06 16:15:29 +05:30
parent 35e122831a
commit 2c58838bf0

View file

@ -147,10 +147,11 @@ class Item(models.Model):
data['releasedate'] = min(data['releasedate']) data['releasedate'] = min(data['releasedate'])
if 'plot' in data: if 'plot' in data:
data['summary'] = data.pop('plot') data['summary'] = data.pop('plot')
if isinstance(data['cast'][0], basestring): if 'cast' in data:
data['actor'] = [data['cast'][0]] if isinstance(data['cast'][0], basestring):
else: data['actor'] = [data['cast'][0]]
data['actor'] = [c[0] for c in data['cast']] else:
data['actor'] = [c[0] for c in data['cast']]
self.external_data = data self.external_data = data
self.save() self.save()