Esempio n. 1
0
def positions(request, job_id=None):
    if job_id:
        position = get_object_or_404(Position, job_id=job_id)
        return HttpResponse(serialize((position,)),
                            content_type='application/json')
    params = _cleanse_params(request.GET)
    positions = Position.objects.filter(**params)
    if not positions:
        return HttpResponseNotFound()
    return HttpResponse(serialize(positions), content_type='application/json')
Esempio n. 2
0
def positions(request, job_id=None):
    if job_id:
        position = get_object_or_404(Position, job_id=job_id)
        return HttpResponse(serialize((position, )),
                            content_type='application/json')
    params = _cleanse_params(request.GET)
    positions = Position.objects.filter(**params)
    if not positions:
        return HttpResponseNotFound()
    return HttpResponse(serialize(positions), content_type='application/json')
Esempio n. 3
0
def categories(request, category_id=None):
    if category_id:
        category = get_object_or_404(Category, pk=category_id)
        positions = category.position_set.all()
        return HttpResponse(serialize(positions),
                            content_type='application/json')
    params = _cleanse_params(request.GET)
    categories = Category.objects.filter(**params)
    if not categories:
        return HttpResponseNotFound()
    return HttpResponse(serialize(categories), content_type='application/json')
Esempio n. 4
0
def categories(request, category_id=None):
    if category_id:
        category = get_object_or_404(Category, pk=category_id)
        positions = category.position_set.all()
        return HttpResponse(serialize(positions),
                            content_type='application/json')
    params = _cleanse_params(request.GET)
    categories = Category.objects.filter(**params)
    if not categories:
        return HttpResponseNotFound()
    return HttpResponse(serialize(categories), content_type='application/json')