flask/flask_website/views/community.py

42 lines
1 KiB
Python
Raw Normal View History

2010-07-23 13:03:29 +01:00
from flask import Module, render_template, jsonify
from flask_website.twitter import flask_tweets
2010-07-23 13:03:29 +01:00
from flask_website.utils import request_wants_json
2010-07-15 19:25:23 +02:00
from flask_website.listings.projects import projects
2010-07-15 19:25:23 +02:00
mod = Module(__name__, url_prefix='/community')
2010-07-15 19:25:23 +02:00
@mod.route('/')
def index():
return render_template('community/index.html')
2010-07-15 19:25:23 +02:00
@mod.route('/irc/')
def irc():
return render_template('community/irc.html')
2010-07-15 19:25:23 +02:00
@mod.route('/twitter/')
def twitter():
2010-07-23 13:03:29 +01:00
if request_wants_json():
return jsonify(tweets=[t.to_json() for t in flask_tweets])
return render_template('community/twitter.html', tweets=flask_tweets)
2010-07-15 19:25:23 +02:00
@mod.route('/badges/')
def badges():
return render_template('community/badges.html')
2010-07-15 19:25:23 +02:00
@mod.route('/poweredby/')
def poweredby():
2010-07-23 13:03:29 +01:00
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)
2010-07-15 19:25:23 +02:00
@mod.route('/logos/')
def logos():
return render_template('community/logos.html')