More API
This commit is contained in:
parent
8547fdeece
commit
63001a7279
9 changed files with 85 additions and 15 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from flask import Module, render_template
|
||||
from flask import Module, render_template, jsonify
|
||||
from flask_website.twitter import flask_tweets
|
||||
from flask_website.utils import request_wants_json
|
||||
from flask_website.listings.projects import projects
|
||||
|
||||
mod = Module(__name__, url_prefix='/community')
|
||||
|
|
@ -17,6 +18,8 @@ def irc():
|
|||
|
||||
@mod.route('/twitter/')
|
||||
def twitter():
|
||||
if request_wants_json():
|
||||
return jsonify(tweets=[t.to_json() for t in flask_tweets])
|
||||
return render_template('community/twitter.html', tweets=flask_tweets)
|
||||
|
||||
|
||||
|
|
@ -27,6 +30,9 @@ def badges():
|
|||
|
||||
@mod.route('/poweredby/')
|
||||
def poweredby():
|
||||
if request_wants_json():
|
||||
return jsonify((k, [p.to_json() for p in v])
|
||||
for k, v in projects.iteritems())
|
||||
return render_template('community/poweredby.html', projects=projects)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue