names should only show up once

This commit is contained in:
j 2011-04-05 12:49:58 +02:00
parent bac32da382
commit 9a3418d1ea

View file

@ -104,7 +104,7 @@ class Item(models.Model):
public = models.BooleanField(default=False, db_index=True) public = models.BooleanField(default=False, db_index=True)
itemId = models.CharField(max_length=128, unique=True, blank=True) itemId = models.CharField(max_length=128, unique=True, blank=True)
oxdbId = models.CharField(max_length=42, unique=True, blank=True) oxdbId = models.CharField(max_length=42, unique=True, blank=True, null=True)
external_data = fields.DictField(default={}, editable=False) external_data = fields.DictField(default={}, editable=False)
data = fields.DictField(default={}, editable=False) data = fields.DictField(default={}, editable=False)
json = fields.DictField(default={}, editable=False) json = fields.DictField(default={}, editable=False)
@ -179,7 +179,7 @@ class Item(models.Model):
'cinematographers', 'languages', 'genres', 'keywords', 'cinematographers', 'languages', 'genres', 'keywords',
'episode_directors'): 'episode_directors'):
if key in data: if key in data:
data[key[:-1]] = data.pop(key) data[key[:-1]] = list(set(data.pop(key)))
if 'countries' in data: if 'countries' in data:
data['country'] = data.pop('countries') data['country'] = data.pop('countries')
if 'release date' in data: if 'release date' in data:
@ -894,6 +894,9 @@ class Facet(models.Model):
value = models.CharField(max_length=200, db_index=True) value = models.CharField(max_length=200, db_index=True)
value_sort = models.CharField(max_length=200, db_index=True) value_sort = models.CharField(max_length=200, db_index=True)
def __unicode__(self):
return u"%s=%s" % (self.key, self.value)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if not self.value_sort: if not self.value_sort:
self.value_sort = utils.sort_string(self.value) self.value_sort = utils.sort_string(self.value)