geonames are not unique
This commit is contained in:
parent
46996b0e54
commit
6e876c2b4d
3 changed files with 11 additions and 6 deletions
|
@ -32,8 +32,8 @@ class Place(models.Model):
|
|||
name_sort = models.CharField(max_length=200)
|
||||
name_find = models.TextField(default='', editable=False)
|
||||
|
||||
geoname = models.CharField(max_length=1024, unique=True, null=True)
|
||||
geoname_sort = models.CharField(max_length=1024, unique=True, null=True)
|
||||
geoname = models.CharField(max_length=1024, null=True)
|
||||
geoname_sort = models.CharField(max_length=1024, null=True)
|
||||
countryCode = models.CharField(max_length=16, default='')
|
||||
|
||||
wikipediaId = models.CharField(max_length=1000, blank=True)
|
||||
|
|
|
@ -46,11 +46,13 @@ def addPlace(request):
|
|||
name_find__icontains=u'|%s|'%name).count() != 0:
|
||||
exists = True
|
||||
existing_names.append(name)
|
||||
'''
|
||||
if 'geoname' in data:
|
||||
if models.Place.objects.filter(defined=True,
|
||||
geoname=data['geoname']).count() > 0:
|
||||
exists = True
|
||||
existing_geoname = data['geoname']
|
||||
'''
|
||||
if not exists:
|
||||
models.Place.objects.filter(defined=False, name__in=names).delete()
|
||||
place = models.Place()
|
||||
|
@ -103,11 +105,13 @@ def editPlace(request):
|
|||
name_find__icontains=u'|%s|'%name).exclude(id=place.id).count() != 0:
|
||||
conflict = True
|
||||
conflict_names.append(name)
|
||||
'''
|
||||
if 'geoname' in data:
|
||||
if models.Place.objects.filter(defined=True,
|
||||
geoname=data['geoname']).exclude(id=place.id).count() != 0:
|
||||
conflict = True
|
||||
conflict_geoname = data['geoname']
|
||||
'''
|
||||
if not conflict:
|
||||
models.Place.objects.filter(defined=False, name__in=names+alternative_names).delete()
|
||||
for key in data:
|
||||
|
|
|
@ -241,10 +241,11 @@ pandora.ui.infoView = function(data) {
|
|||
['country', 'year', 'language', 'runtime'].forEach(function(key) {
|
||||
if (data[key]) {
|
||||
html.push(
|
||||
formatKey(key)
|
||||
+ (key == 'runtime'
|
||||
? Math.round(data[key] / 60) + ' min'
|
||||
: formatValue(data[key], key))
|
||||
formatKey(key) + (
|
||||
key != 'runtime' ? formatValue(data[key], key)
|
||||
: data[key] < 60 ? Math.round(data[key]) + ' sec'
|
||||
: Math.round(data[key] / 60) + ' min'
|
||||
)
|
||||
)
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue