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)
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)
data = fields.DictField(default={}, editable=False)
json = fields.DictField(default={}, editable=False)
@ -179,7 +179,7 @@ class Item(models.Model):
'cinematographers', 'languages', 'genres', 'keywords',
'episode_directors'):
if key in data:
data[key[:-1]] = data.pop(key)
data[key[:-1]] = list(set(data.pop(key)))
if 'countries' in data:
data['country'] = data.pop('countries')
if 'release date' in data:
@ -894,6 +894,9 @@ class Facet(models.Model):
value = 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):
if not self.value_sort:
self.value_sort = utils.sort_string(self.value)