From 1624439bba720196592c4b70e34d2ae074b954fb Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 6 Sep 2022 00:50:02 -0700 Subject: [PATCH] update api with new models --- suchwow/routes/api.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/suchwow/routes/api.py b/suchwow/routes/api.py index cff07f9..b270546 100644 --- a/suchwow/routes/api.py +++ b/suchwow/routes/api.py @@ -1,7 +1,6 @@ from flask import jsonify, Blueprint, url_for, request, abort -from suchwow.models import Post -from suchwow import wownero +from suchwow._models import Post bp = Blueprint("api", "api") @@ -22,18 +21,17 @@ def api_list(): limit = 30 all_posts = [] - posts = Post.select().where(Post.approved==True).order_by(Post.timestamp.desc()).limit(limit).offset(offset) + posts = Post.select().where( + Post.approved == True + ).order_by( + Post.timestamp.desc() + ).limit(limit).offset(offset) for post in posts: - wallet = wownero.Wallet() - if wallet.connected: - address = wallet.get_address(account=post.account_index) - else: - address = '' payload = { 'image': url_for('post.uploaded_file', filename=post.image_name, _external=True), - 'submitter': post.submitter, - 'address': address, + 'submitter': post.user.username, + 'address': post.address, 'title': post.title, 'text': post.text, 'href': url_for('post.read', id=post.id, _external=True),