@csrf_exempt
@require_sync_session
@api_handle_error_with_json
def model_upload(data, session):
 if ('models' not in data):
  return JsonResponseMessageError('Must provide models.', data={'saved_model_count': 0}, status=400)
 try:
  result = save_serialized_models(data['models'], src_version=session.client_version)
 except Exception as e:
  print ('Exception uploading models (in api_views): %s, %s, %s' % (e.__class__.__name__, e.message, e.args))
  result = {'error': e.message, 'saved_model_count': 0}
 session.models_uploaded += result['saved_model_count']
 session.errors += result.has_key('error')
 return JsonResponse(result)

@ csrf_exempt @ require_sync_session @ api_handle_error_with_json def model_upload ( data , session ) : if ( 'models' not in data ) : return JsonResponseMessageError ( 'Must provide models.' , data = { 'saved_model_count' : 0 } , status = 400 ) try : result = save_serialized_models ( data [ 'models' ] , src_version = session . client_version ) except Exception as e : print ( 'Exception uploading models (in api_views): %s, %s, %s' % ( e . __class__ . __name__ , e . message , e . args ) ) result = { 'error' : e . message , 'saved_model_count' : 0 } session . models_uploaded += result [ 'saved_model_count' ] session . errors += result . has_key ( 'error' ) return JsonResponse ( result )
this device is getting data-related objects from another device .