Browse Source

Update Movie to version 1 which support en/th

master
sipp11 10 years ago
parent
commit
ec5ce95e77
  1. 13
      flasky.py

13
flasky.py

@ -68,14 +68,21 @@ def hello_world():
@app.route('/movies/', methods=['GET'])
@app.route('/movies/<lang>/', methods=['GET'])
@crossdomain(origin='*')
def movie_list():
def movie_list(lang='en'):
result = db.movies.find()
movies = []
for i in result:
if 'original' in i['title']:
i['original_title'] = i['title']['original']
i['title'] = i['title'][lang]
i['cast'] = i['cast'][lang]
i['tagline'] = i['tagline'][lang]
i['storyline'] = i['storyline'][lang]
i['director'] = i['director'][lang]
movies.append(i)
if len(movies) > 10:
break
json_dict = {
'meta': {
'total_count': len(movies)

Loading…
Cancel
Save