【问题标题】:Flask return two string for self烧瓶为自己返回两个字符串
【发布时间】:2020-10-02 04:05:15
【问题描述】:

我遇到了烧瓶应用程序构建器问题

型号

class Allusernote(Model):
    id = Column(Integer, primary_key=True)
    content = Column(Text(250))

    def __repr__(self):
        return self.content

查看

  class Allusernote(ModelView):
        datamodel = SQLAInterface(PushAll)
        list_columns = ['id', 'content']
        @action("Notification","to All  Staff ","Notification?","fa-rocket")

        def getdata(self,data):
            return data

现在我只能将内容传递给数据, 如何传递 id 和 content 来查看,当我使用 id 返回 id 时,使用 content 返回内容

【问题讨论】:

    标签: python flask flask-appbuilder


    【解决方案1】:

    我找到了一些简单的数据列表

    @app.route('/list', methods=['GET'])
    def list():
        table = dynamodb.Table('users')
        articles = []
        if request.method == 'GET':
            # Get all articles
            response = table.scan()
            articles = response.get('Items')
    
        return render_template('index.html', articles=articles, title='List Articles')
    

    【讨论】:

      猜你喜欢
      • 2016-10-13
      • 2020-08-21
      • 2018-03-26
      • 2019-05-03
      • 1970-01-01
      • 1970-01-01
      • 2019-03-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多