forked from 0x2620/pandora
create undefined places/events
This commit is contained in:
parent
daaabba071
commit
1f1683c5a5
7 changed files with 120 additions and 43 deletions
|
|
@ -9,6 +9,12 @@ import models
|
|||
def update_matching_events(id):
|
||||
from event.models import Event
|
||||
annotation = models.Annotation.objects.get(pk=id)
|
||||
for e in annotation.events.filter(defined=False):
|
||||
if e.annotations.exclude(id=id).count() == 0:
|
||||
e.delete()
|
||||
if annotation.get_layer().get('type') == 'event' \
|
||||
and annotation.events.count() == 0:
|
||||
annotations.events.add(Event.get_or_create(annotation.value))
|
||||
for e in annotation.events.all():
|
||||
e.update_matches()
|
||||
ids = [e['id'] for e in Event.objects.all().values('id')]
|
||||
|
|
@ -23,6 +29,12 @@ def update_matching_events(id):
|
|||
def update_matching_places(id):
|
||||
from place.models import Place
|
||||
annotation = models.Annotation.objects.get(pk=id)
|
||||
for p in annotation.places.filter(defined=False):
|
||||
if p.annotations.exclude(id=id).count() == 0:
|
||||
p.delete()
|
||||
if annotation.get_layer().get('type') == 'place' \
|
||||
and annotation.places.count() == 0:
|
||||
annotation.places.add(Place.get_or_create(annotation.value))
|
||||
for p in annotation.places.all():
|
||||
p.update_matches()
|
||||
ids = [e['id'] for e in Place.objects.all().values('id')]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue