def commit(request, import_event_id, import_type=None): #TODO:!!! NEED TO ADD TREES TO WATCH LIST #TODO:!!! Trees in the same import event should not cause # proximity issues #TODO:!!! NEED TO INDICATE TREES TO BE ADDED TO WATCH LIST #TODO:!!! NEED TO CLEAR TILE CACHE #TODO:!!! If 'Plot' already exists on row *update* when changed if import_type == 'species': model = SpeciesImportEvent elif import_type == 'tree': model = TreeImportEvent else: raise Exception('invalid import type') ie = model.objects.get(pk=import_event_id) ie.status = GenericImportEvent.CREATING ie.save() ie.rows().update(status=GenericImportRow.WAITING) transaction.commit() commit_import_event.delay(ie) #TODO: Update tree counts for species return HttpResponse(json.dumps({'status': 'done'}), content_type='application/json')
def commit(request, import_event_id, import_type=None): #TODO:!!! NEED TO ADD TREES TO WATCH LIST #TODO:!!! Trees in the same import event should not cause # proximity issues #TODO:!!! NEED TO INDICATE TREES TO BE ADDED TO WATCH LIST #TODO:!!! NEED TO CLEAR TILE CACHE #TODO:!!! If 'Plot' already exists on row *update* when changed if import_type == 'species': model = SpeciesImportEvent elif import_type == 'tree': model = TreeImportEvent else: raise Exception('invalid import type') ie = model.objects.get(pk=import_event_id) ie.status = GenericImportEvent.CREATING ie.save() ie.rows().update(status=GenericImportRow.WAITING) transaction.commit() commit_import_event.delay(ie) #TODO: Update tree counts for species return HttpResponse( json.dumps({'status': 'done'}), content_type = 'application/json')
def commit(request, instance, import_type, import_event_id): ie = _get_import_event(instance, import_type, import_event_id) ie.status = GenericImportEvent.CREATING ie.save() ie.rows().update(status=GenericImportRow.WAITING) commit_import_event.delay(import_type, import_event_id) return list_imports(request, instance)
def commit(request, instance, import_type, import_event_id): ie = _get_import_event(instance, import_type, import_event_id) if _get_tree_limit_context(ie).get('tree_limit_exceeded'): raise Exception(trans("tree limit exceeded")) ie.status = GenericImportEvent.CREATING ie.save() ie.rows().update(status=GenericImportRow.WAITING) commit_import_event.delay(import_type, import_event_id) return list_imports(request, instance)
def commit(request, instance, import_type, import_event_id): ie = _get_import_event(instance, import_type, import_event_id) if _get_tree_limit_context(ie).get('tree_limit_exceeded'): raise Exception(_("tree limit exceeded")) ie.status = GenericImportEvent.CREATING ie.save() ie.rows().update(status=GenericImportRow.WAITING) commit_import_event.delay(import_type, import_event_id) return list_imports(request, instance)