예제 #1
0
파일: views.py 프로젝트: gmist/1businka
def category_json(request, category_id):
    category = Category.get_by_id(category_id)
    if not category:
        return render_json_response({
            'api':{
                'success': False,
                'msg': 'Category %s not found' % category_id
            }
        }, status=400)

    if request.method == 'GET':
        return get_category(category)

    if request.method == 'DELETE':
        return delete_category(request, category)

    if request.method == 'PUT':
        return put_category(request, category)

    return render_json_response({
        'api':{
            'success':False,
            'msg': 'Request method %s not supported' % request.method
        }
    }, status=400)
예제 #2
0
파일: views.py 프로젝트: gmist/1businka
def category_create(request):
    return put_category(request, None, True)