json for image search working
This commit is contained in:
parent
af030d92d7
commit
31550185b6
|
@ -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)
|
||||
|
|
|
@ -4,7 +4,7 @@ from os.path import join
|
|||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
JSON_DEBUG = DEBUG
|
||||
ADMINS = (
|
||||
# ('Your Name', 'your_email@domain.com'),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user