forked from 0x2620/pandora
avoid DoesNotExist errors while updating matches
This commit is contained in:
parent
7b629bd468
commit
4629d64361
1 changed files with 16 additions and 10 deletions
|
@ -21,11 +21,14 @@ def update_matching_events(id):
|
||||||
e.update_matches()
|
e.update_matches()
|
||||||
ids = [e['id'] for e in Event.objects.all().values('id')]
|
ids = [e['id'] for e in Event.objects.all().values('id')]
|
||||||
for i in ids:
|
for i in ids:
|
||||||
e = Event.objects.get(pk=i)
|
try:
|
||||||
for name in [e.name] + list(e.alternativeNames):
|
e = Event.objects.get(pk=i)
|
||||||
if name.lower() in a.value.lower():
|
for name in [e.name] + list(e.alternativeNames):
|
||||||
e.update_matches()
|
if name.lower() in a.value.lower():
|
||||||
break
|
e.update_matches()
|
||||||
|
break
|
||||||
|
except Event.DoesNotExist:
|
||||||
|
pass
|
||||||
|
|
||||||
@task(ignore_resulsts=True, queue='default')
|
@task(ignore_resulsts=True, queue='default')
|
||||||
def update_matching_places(id):
|
def update_matching_places(id):
|
||||||
|
@ -42,11 +45,14 @@ def update_matching_places(id):
|
||||||
p.update_matches()
|
p.update_matches()
|
||||||
ids = [e['id'] for e in Place.objects.all().values('id')]
|
ids = [e['id'] for e in Place.objects.all().values('id')]
|
||||||
for i in ids:
|
for i in ids:
|
||||||
e = Place.objects.get(pk=i)
|
try:
|
||||||
for name in [e.name] + list(e.alternativeNames):
|
e = Place.objects.get(pk=i)
|
||||||
if name.lower() in a.value.lower():
|
for name in [e.name] + list(e.alternativeNames):
|
||||||
e.update_matches()
|
if name.lower() in a.value.lower():
|
||||||
break
|
e.update_matches()
|
||||||
|
break
|
||||||
|
except Place.DoesNotExist:
|
||||||
|
pass
|
||||||
|
|
||||||
@task(ignore_resulsts=True, queue='default')
|
@task(ignore_resulsts=True, queue='default')
|
||||||
def update_item(id):
|
def update_item(id):
|
||||||
|
|
Loading…
Reference in a new issue