title: How to make some fields optional in form in flask
body: <p>I need to know how to handle the optional field in the form.this is my full code of that function.............................................................................................................................................</p>
  
  <pre><code>    def post(self):
      print(request.headers['Content-Type'])
      email = request.form.get('email')
      title = request.form.get('title')
      os_type=request.form.get('os_type')
      device_type=request.form.get('device_type')
      message=request.form.get('message')
      file = request.files.get('file')
      target_url = request.form.get('target_url')
      print(email)
      if email == None and email == '':
          st="email is required"
          data=error_call(st)
          return(data),400,{'Content-Type': 'application/json'}
      else:
          return (email)
          if title== None and title == '':
              st="title is required"
              data=error_call(st)
              return(data),400,{'Content-Type': 'application/json'}
          else:
              if message==None and message== "":
                  return(error_call("message is requied")),400,{'Content-Type': 'application/json'}
              else:
                  date=datetime.now()
                  if file:
                      a=20
                      print(a)
                      if a&gt;20000:
                          return(error_call("sixe of file exceeded"))
                      else:
  
                          if file.filename == '':
                              return "no file"
                          if file and allowed_file(file.filename):
                              file.filename = title
                              filename = secure_filename(file.filename)
                              file.save(os.path.join('images/push_uploads', filename))
                              image_url='http://127.0.0.1:5000/'+'images/push_uploads'+'/'+filename
  
                              data_message = {
                              "to":"dkmdi",
                              "content_available":"true",
                              "mutable_content":"true",
                              "data":{
                             "mediaUrl":image_url
                              },
                              "notification":{
                                  "body" : "mmsiadk",
                                  "type" :"message_type",
                                  "sound" :"default"
  
                              }
  
                              }
                              print(image_url)
                              registration_id ="cVFt1vC16j8:APA91bEhRS1mvPn3NZGODC4zoGjcsfmhV59cpqRd_i0Rmh1fwjgIj8bdxPlLoxlJkS5HBtEeFuE-ZSt3Uc6S0RwkT9UDqTdwYOiJa0gByNc09hZT1iVFSMM2BuuEXoLg5cARmOe73S5c"
                              message_body = title
                              #result = push_service.notify_single_device(registration_id=registration_id, message_body=message_body,data_message=data_message)
                              #print(result)
  </code></pre>
  
  <p>When I didn't send some of the field using postman  I get the error</p>
  
  <pre><code>"message": "The browser (or proxy) sent a request that this server could not understand."}
  </code></pre>
  
  <p>so I need no how to handle optional fields in python form</p>