make new api work
This commit is contained in:
parent
f2944b1b75
commit
c0b3bdd29c
4 changed files with 12 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
|||
import re
|
||||
from datetime import datetime
|
||||
from urllib2 import unquote
|
||||
import json
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
|
@ -30,10 +31,14 @@ class MovieManager(Manager):
|
|||
also checks for lists.
|
||||
range and order must be applied later
|
||||
'''
|
||||
'''
|
||||
q = ''
|
||||
for i in request.META['QUERY_STRING'].split('&'):
|
||||
if i.startswith('q='):
|
||||
q = i[2:]
|
||||
'''
|
||||
q = json.loads(request.POST['data'])['q']
|
||||
print q
|
||||
op = ','
|
||||
if '|' in q:
|
||||
op = '|'
|
||||
|
|
|
@ -39,7 +39,8 @@ def api(request):
|
|||
response = f(request)
|
||||
else:
|
||||
response = {'status': 404, 'statusText': 'Unknown function %s' % function}
|
||||
return render_to_json_response(response)
|
||||
response = render_to_json_response(response)
|
||||
return response
|
||||
|
||||
def api_hello(request):
|
||||
'''
|
||||
|
@ -162,7 +163,7 @@ def _order_query(qs, s, prefix='sort__'):
|
|||
return qs
|
||||
|
||||
def _parse_query(request):
|
||||
get = request.GET
|
||||
get = json.loads(request.POST['data'])
|
||||
query = {}
|
||||
query['i'] = 0
|
||||
query['o'] = 100
|
||||
|
@ -320,7 +321,7 @@ POST update
|
|||
}
|
||||
'''
|
||||
#@login_required_json
|
||||
def api_update(request, archive):
|
||||
def api_update(request):
|
||||
print "update request"
|
||||
data = json.loads(request.POST['data'])
|
||||
archive = data['archive']
|
||||
|
|
|
@ -10,7 +10,7 @@ admin.autodiscover()
|
|||
urlpatterns = patterns('',
|
||||
# Example:
|
||||
(r'^ajax_filtered_fields/', include('ajax_filtered_fields.urls')),
|
||||
(r'^api/', include('backend.views.api')),
|
||||
(r'^api/', 'backend.views.api'),
|
||||
(r'^$', 'app.views.index'),
|
||||
|
||||
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
|
||||
|
|
Loading…
Reference in a new issue