@expose("<STR_LIT>", methods=["<STR_LIT>"])<EOL><INDENT>@protect()<EOL>@safe<EOL>@permission_name("<STR_LIT>")<EOL>def put(self, pk):<DEDENT>
item = self.datamodel.get(pk, self._base_filters)<EOL>if not request.is_json:<EOL><INDENT>return self.response(<NUM_LIT>, **{"<STR_LIT:message>": "<STR_LIT>"})<EOL><DEDENT>if not item:<EOL><INDENT>return self.response_404()<EOL><DEDENT>try:<EOL><INDENT>data = self._merge_update_item(item, request.json)<EOL>item = self.edit_model_schema.load(data, instance=item)<EOL><DEDENT>except ValidationError as err:<EOL><INDENT>return self.response_422(message=err.messages)<EOL><DEDENT>if isinstance(item.data, dict):<EOL><INDENT>return self.response_422(message=item.errors)<EOL><DEDENT>self.pre_update(item.data)<EOL>try:<EOL><INDENT>self.datamodel.edit(item.data, raise_exception=True)<EOL>self.post_update(item)<EOL>return self.response(<EOL><NUM_LIT:200>,<EOL>**{<EOL>API_RESULT_RES_KEY: self.edit_model_schema.dump(<EOL>item.data, many=False<EOL>).data<EOL>}<EOL>)<EOL><DEDENT>except IntegrityError as e:<EOL><INDENT>return self.response_422(message=str(e.orig))<EOL><DEDENT>
POST item to Model
        ---
        put:
          parameters:
          - in: path
            schema:
              type: integer
            name: pk
          requestBody:
            description: Model schema
            required: true
            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/{{self.__class__.__name__}}.put'
          responses:
            200:
              description: Item changed
              content:
                application/json:
                  schema:
                    type: object
                    properties:
                      result:
                        $ref: '#/components/schemas/{{self.__class__.__name__}}.put'
            400:
              $ref: '#/components/responses/400'
            401:
              $ref: '#/components/responses/401'
            404:
              $ref: '#/components/responses/404'
            422:
              $ref: '#/components/responses/422'
            500:
              $ref: '#/components/responses/500'