Example #1
0
def retrieve_ringtones(request):
    'Retrieve ringtones by category'
    #response["Content-Type"] = "application/json"
    query_dict = request.GET
    category_id = query_dict.get('category_id', '0')
    sort_order = query_dict.get('sort_order', '')
    page_size = query_dict.get('page_size', "20")
    page_no = query_dict.get('page_no', '1')
    ringtones = query_ringtones(int(category_id), None, sort_order)
    ringtones = page_ringtones(ringtones, int(page_size), int(page_no))
    json = jsonize_ringtones(ringtones)
    return HttpResponse(json)
Example #2
0
def search_ringtones(request):
    'Search ringtones by a keyword.'
    query_dict = request.GET
    keyword = query_dict.get('keyword', '')
    category_id = query_dict.get('category_id', '0')
    sort_order = query_dict.get('sort_order', '')
    page_size = query_dict.get('page_size', '20')
    page_no = query_dict.get('page_no', '1')
    ringtones = query_ringtones(int(category_id), keyword, sort_order)
    ringtones = page_ringtones(ringtones, int(page_size), int(page_no))
    json = jsonize_ringtones(ringtones)
    return HttpResponse(json)