def post(self, request, *args, **kwargs): retval = self.create(request, *args, **kwargs) track_rest_push(request) if not settings.DEV_MODE: # carefuly DO NOT push it to InaWARE when in dev_mode push_shake_to_inaware.delay(request.data.get('shake_id')) return retval
def post(self, request, *args, **kwargs): retval = self.create(request, *args, **kwargs) track_rest_push(request) if not settings.DEV_MODE: # carefuly DO NOT push it to InaWARE when in dev_mode push_shake_to_inaware.delay( request.data.get('shake_id'), request.data.get('source_type')) return retval
def put(self, request, *args, **kwargs): try: data = request.data shake_id = kwargs.get('shake_id') or data.get('shake_id') instance = Earthquake.objects.get(shake_id=shake_id) if 'shake_grid' in request.FILES and instance.shake_grid: instance.shake_grid.delete() if 'mmi_output' in request.FILES and instance.mmi_output: instance.mmi_output.delete() except Earthquake.DoesNotExist: pass retval = self.update(request, partial=True, *args, **kwargs) track_rest_push(request) return retval
def put(self, request, *args, **kwargs): try: data = request.data shake_id = kwargs.get('shake_id') or data.get('shake_id') source_type = kwargs.get('source_type') or data.get('source_type') instance = Earthquake.objects.get( shake_id=shake_id, source_type=source_type) if 'shake_grid' in request.FILES and instance.shake_grid: instance.shake_grid.delete() if 'mmi_output' in request.FILES and instance.mmi_output: instance.mmi_output.delete() except Earthquake.DoesNotExist: pass retval = self.update(request, partial=True, *args, **kwargs) track_rest_push(request) return retval