parameters: (request:HttpRequest, project_id, interval_id)
return_statement: return JsonResponse({
          'id': interval.id,
          'interval_state_id': interval.interval_state_id
      })
docstring: Set state of an interval.
      ---
      parameters:
       - name: interval_id
         description: Interval to update state of
         type: integer
         paramType: form
         required: true
docstring_summary: Set state of an interval.
      ---
      parameters:
       - name: interval_id
         description: Interval to update state of
         type: integer
         paramType: form
         required: true
docstring_tokens: Set state of an interval . --- parameters : - name : interval_id description : Interval to update state of type : integer paramType : form required : true
function: def set_interval_state(request:HttpRequest, project_id, interval_id) -> JsonResponse:
      """Set state of an interval.
      ---
      parameters:
       - name: interval_id
         description: Interval to update state of
         type: integer
         paramType: form
         required: true
      """
      interval_id = int(interval_id)
      interval = SamplerInterval.objects.get(id=interval_id)
  
      interval_state_id = int(request.POST.get('state_id'))
      if interval_state_id is None:
          raise ValueError("Need interval state ID")
  
      interval.interval_state_id = interval_state_id
      interval.save()
  
      return JsonResponse({
          'id': interval.id,
          'interval_state_id': interval.interval_state_id
      })
function_tokens: def set_interval_state ( request : HttpRequest , project_id , interval_id ) -> JsonResponse : interval_id = int ( interval_id ) interval = SamplerInterval . objects . get ( id = interval_id ) interval_state_id = int ( request . POST . get ( 'state_id' ) ) if interval_state_id is None : raise ValueError ( "Need interval state ID" ) interval . interval_state_id = interval_state_id interval . save ( ) return JsonResponse ( { 'id' : interval . id , 'interval_state_id' : interval . interval_state_id } )