konova/konova/tasks.py
mpeltriaux d6d15185ea #55 Celery parcel updating
* adds celery to project
* adds celery background task for updating parcels
* adds parcel calculation to creating of new geometries as well
* tests outstanding!!!
2022-01-06 12:08:38 +01:00

15 lines
347 B
Python

from celery import shared_task
from django.core.exceptions import ObjectDoesNotExist
from konova.models import Geometry
@shared_task
def celery_update_parcels(geometry_id: str):
try:
geom = Geometry.objects.get(id=geometry_id)
geom.parcels.clear()
geom.update_parcels()
except ObjectDoesNotExist:
return