forked from 0x2620/pandora
place/event matching task that could be used saving annotations
This commit is contained in:
parent
16d6c2c0fe
commit
dd8aee522c
5 changed files with 42 additions and 9 deletions
27
pandora/annotation/tasks.py
Normal file
27
pandora/annotation/tasks.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from celery.decorators import task
|
||||
|
||||
|
||||
|
||||
@task(ignore_resulsts=True, queue='default')
|
||||
def update_matching_events(value):
|
||||
from event.models import Event
|
||||
ids = [e['id'] for e in Event.objects.all().values('id')]
|
||||
for i in ids:
|
||||
e = Event.objects.get(pk=i)
|
||||
for name in [e.name] + list(e.alternativeNames):
|
||||
if name in value:
|
||||
e.update_matches()
|
||||
break
|
||||
|
||||
@task(ignore_resulsts=True, queue='default')
|
||||
def update_matching_places(value):
|
||||
from place.models import Place
|
||||
ids = [e['id'] for e in Place.objects.all().values('id')]
|
||||
for i in ids:
|
||||
e = Place.objects.get(pk=i)
|
||||
for name in [e.name] + list(e.alternativeNames):
|
||||
if name in value:
|
||||
e.update_matches()
|
||||
break
|
||||
Loading…
Add table
Add a link
Reference in a new issue