def index(subdomain='www'): if not current_user.is_authenticated: return redirect(url_for("auth.login", subdomain=subdomain)) search_terms = request.args.get("q") if search_terms: title = "Search for \"" + search_terms + "\"" else: title = "Trending" items = Controller.index(search_terms=search_terms, subdomain=subdomain) if len(items[0]) == 0 and not search_terms: flash( "Welcome, there is no article yet in your company. Submit the first one by clicking the submit button", "success") if len(items[0]) == 0 and search_terms: flash("We did not find any matching result", "warning") return render_template( "index.html", subdomain=subdomain, title=title, posts=items[0], next_url=items[1], start_rank_num=items[2], )
def get(self, page=1): items = Controller.index(page) return jsonify([i.id for i in items[0]])
def get(self, page=1): items = Controller.index(page) return jsonify( [json.loads(i.to_json(max_nesting=1)) for i in items[0]])