code: def put(self, template_name):
          
          self.reqparse.add_argument('template', type=str, required=True)
          args = self.reqparse.parse_args()
  
          template = db.Template.find_one(template_name=template_name)
  
          if not template:
              return self.make_response('No such template found', HTTP.NOT_FOUND)
  
          changes = diff(template.template, args['template'])
          template.template = args['template']
          template.is_modified = True
  
          db.session.add(template)
          db.session.commit()
          auditlog(
              event='template.update',
              actor=session['user'].username,
              data={
                  'template_name': template_name,
                  'template_changes': changes
              }
          )
  
          return self.make_response('Template {} has been updated'.format(template_name))
docs: Update a template