rename items instead of merge

This commit is contained in:
j 2011-10-24 23:41:55 +02:00
parent b77a29933c
commit 408af96aa2

View file

@ -264,10 +264,19 @@ class Item(models.Model):
if self.oxdbId != oxdbId:
q = Item.objects.filter(oxdbId=oxdbId).exclude(id=self.id)
if q.count() != 0:
self.oxdbId = None
q[0].merge_with(self, save=False)
else:
self.oxdbId = oxdbId
if len(self.itemId) == 7:
self.oxdbId = None
q[0].merge_with(self, save=False)
else:
n = 1
key = 'episodeTitle' in self.data and 'episodeTitle' or 'title'
title = self.get(key, 'Untitled')
while q.count() != 0:
n += 1
self.data[key] = u'%s [%d]' % (title, n)
oxdbId = self.oxdb_id()
q = Item.objects.filter(oxdbId=oxdbId).exclude(id=self.id)
self.oxdbId = oxdbId
update_poster = True
#id changed, what about existing item with new id?