fix addPlace
This commit is contained in:
parent
fba62c15f4
commit
c017e935ad
1 changed files with 4 additions and 3 deletions
|
@ -39,8 +39,9 @@ def addPlace(request):
|
||||||
exists = False
|
exists = False
|
||||||
existing_names = []
|
existing_names = []
|
||||||
existing_geoname = ''
|
existing_geoname = ''
|
||||||
names = data.pop('name')
|
name = data.pop('name')
|
||||||
for name in [names] + data.get('alternativeNames', []):
|
names = [name] + data.get('alternativeNames', [])
|
||||||
|
for name in names:
|
||||||
if models.Place.objects.filter(defined=True,
|
if models.Place.objects.filter(defined=True,
|
||||||
name_find__icontains=u'|%s|'%name).count() != 0:
|
name_find__icontains=u'|%s|'%name).count() != 0:
|
||||||
exists = True
|
exists = True
|
||||||
|
@ -56,7 +57,7 @@ def addPlace(request):
|
||||||
models.Place.objects.filter(defined=False, name__in=names).delete()
|
models.Place.objects.filter(defined=False, name__in=names).delete()
|
||||||
place = models.Place()
|
place = models.Place()
|
||||||
place.user = request.user
|
place.user = request.user
|
||||||
place.name = names
|
place.name = name
|
||||||
place.alternativeNames = tuple(data.pop('alternativeNames', []))
|
place.alternativeNames = tuple(data.pop('alternativeNames', []))
|
||||||
for key in data:
|
for key in data:
|
||||||
value = data[key]
|
value = data[key]
|
||||||
|
|
Loading…
Reference in a new issue