reset string values

This commit is contained in:
j 2016-11-18 14:13:43 +02:00
parent ef075ffb78
commit 6970cbd08e

View file

@ -46,7 +46,7 @@ def find(info, guess=True):
value = normalize_value('\n'.join(info[key]) + '\n') value = normalize_value('\n'.join(info[key]) + '\n')
else: else:
value = normalize_value(info[key]) value = normalize_value(info[key])
q = q.filter(**{fkey:value}) q = q.filter(**{fkey: value})
if q.count() == 1: if q.count() == 1:
m = q[0] m = q[0]
m.update() m.update()
@ -122,7 +122,7 @@ class Imdb(models.Model):
if isinstance(value, str): if isinstance(value, str):
value = normalize_value(value) value = normalize_value(value)
setattr(self, key, value) setattr(self, key, value)
else: elif isinstance(getattr(self, key), str):
setattr(self, key, '') setattr(self, key, '')
if self.season and self.season < 0: if self.season and self.season < 0:
self.season = None self.season = None