json for image search working

This commit is contained in:
Sanj 2011-10-06 00:29:37 +05:30
parent af030d92d7
commit 31550185b6
2 changed files with 8 additions and 2 deletions

View File

@ -1,10 +1,16 @@
# Create your views here.
from django.shortcuts import render_to_response
from ox.django.shortcuts import render_to_json_response
from bingapi import bingapi
from settings import LIVE_APP_ID
def index(request):
return render_to_response("home.html", {})
def search(request):
d = {}
q = request.GET.get("q")
bing = bingapi.Bing(LIVE_APP_ID)
results = bing.do_image_search(q)
images = results['SearchResponse']['Image']['Results']
d = images
return render_to_json_response(d)

View File

@ -4,7 +4,7 @@ from os.path import join
DEBUG = True
TEMPLATE_DEBUG = DEBUG
JSON_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)