烧瓶返回两个字符串

时间:2020-06-12 10:42:36

标签: python flask flask-appbuilder

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

型号

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和内容进行查看,当我使用ID返回ID时,使用内容返回内容

1 个答案:

答案 0 :(得分:0)

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

@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')