* adds celery to project * adds celery background task for updating parcels * adds parcel calculation to creating of new geometries as well * tests outstanding!!!
15 lines
347 B
Python
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
|