コード例 #1
0
 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
コード例 #2
0
ファイル: earthquake.py プロジェクト: inasafe/inasafe-django
 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
コード例 #3
0
 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
コード例 #4
0
ファイル: earthquake.py プロジェクト: inasafe/inasafe-django
 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