예제 #1
0
def asset_category(request, type):
    assets = asset_handle.fetch_asset_list(type)
    obj = models.Assets.objects.all()
    data = pages(request, obj, 10)
    print(obj)
    return render(request, 'assets/asset.html', {
        'assets': assets,
        'posts': data
    })
예제 #2
0
def asset_list(request):
    if request.method == 'GET':
        assets = asset_handle.fetch_asset_list()
        obj = models.Assets.objects.all()
        data = pages(request, obj, 10)
        print('new', obj)
        return render(request, 'assets/asset.html', {
            'assets': assets,
            'posts': data
        })
예제 #3
0
def assets_approval(request):
    if request.method == 'GET':
        type = 'approved'
        assets = asset_handle.fetch_asset_list(type)
        obj = models.Assets.objects.all().filter(approved=False)
        data = pages(request, obj, 10)
        return render(request, 'assets/assets_approval.html', {
            'asset_data': assets,
            'posts': data
        })
    else:
        id_list = request.POST.getlist('ids[]')
        print('id_list', id_list)
        obj_list = models.Assets.objects.filter(id__in=id_list).update(
            approved=True)
        print(obj_list)
        return HttpResponse('ok')