Пример #1
0
def listCompany(request):
    model = Company
    default_GET = '?reverse=false&order_by=-created&search_field=name&filter_option=__icontains&search_data=&search_data2=&relation=%26&page=1'

    if not request.GET:
        return set_default(model, request, default_GET)

    result = get_objects_by_request_ex(request,
                                       model,
                                       default_GET,
                                       relation_model='business_category')
    if result['success']:
        objects, page = result['data']
    else:
        return set_default(model, request, default_GET)

    set_session(request, objects, model)
    total = len(objects)
    paginator = Paginator(objects, PAGE)

    try:
        objects = paginator.page(page)
    except:
        objects = paginator.page(1)

    content = {
        'objects': objects,
        'total': total,
    }
    content.update(Company.get_state())

    return render(request, 'post/company/list.html', content)
Пример #2
0
def listIpstune(request):
    model = IPSTune
    default_GET = '?reverse=false&order_by=-created&search_field=title&filter_option=__icontains&search_data=&search_data2=&relation=%26&page=1'

    if not request.GET:
        return set_default(model, request, default_GET)

    result = get_objects_by_request_ex(request, model, default_GET)
    if result['success']:
        objects, page = result['data']
    else:
        print(result['error'])
        return set_default(model, request, default_GET)

    set_session(request, objects, model)
    total = len(objects)
    paginator = Paginator(objects, PAGE)

    try:
        objects = paginator.page(page)
    except:
        objects = paginator.page(1)

    content = {
        'objects': objects,
        'total': total,
    }
    return render(request, 'post/ipstune/list.html', content)
Пример #3
0
def listSymptom(request):
    model = Symptom
    default_GET = '?reverse=false&order_by=-created&search_field=company__name&filter_option=__icontains&search_data=&search_data2=&relation=%26&page=1'

    if not request.GET:
        return set_default(model, request, default_GET)

    result = get_objects_by_request_ex(request, model, default_GET, relation_model='response_type')
    if result['success']:
        objects, page = result['data']
    else:
        print('error : ', result.get('error', '알수없음'))
        return set_default(model, request, default_GET)

    set_session(request,objects,model)
    total = len(objects)
    paginator = Paginator(objects, PAGE)

    try:
        objects = paginator.page(page)
    except:
        objects = paginator.page(1)

    content = {
        'objects':objects,
        'total':total,
    }
    return render(request, 'post/symptom/list.html', content)