Esempio n. 1
0
def myGoodsJson(request):
    columns = ['pk',  'category', 'submitDate', 'status']
    data = Good.objects.filter(user=request.user)
    my_dict = {'show_status': True}


    return jsonListGenerator(request=request, columns=columns, data=data, my_dict=my_dict,
                             template="json/allgoods.json")
Esempio n. 2
0
def viewOrderJson(request,edit=False,show_status=True,accepted=False,filters={}):
    columns = ['pk','category__name','quantity','description','status','order']
    if not show_status:
        columns.remove('status')

    data = OrderItem.objects.all()
    return jsonListGenerator(request = request, columns = columns, data = data,
                             template = "json/orderitem.json",my_dict={"edit":edit,"show_status":show_status,"accepted":accepted},
                             default_filters=filters)
Esempio n. 3
0
def allGoodsJson(request):
    columns = ['pk', 'user', 'category', 'submitDate', 'status']
    data = Good.objects.all()
    my_dict = {'show_status': True, 'show_user': True,'show_buttons' : True}
    if request.user.groups.all()[0].name == 'T':
        my_dict.update({'show_receipt': True})

    return jsonListGenerator(request=request, columns=columns, data=data, my_dict=my_dict,
                             template="json/allgoods.json")
Esempio n. 4
0
def ordersJson(request,show_status=True,show_user=False,show_edit=False,filters={}):
    columns = ['pk', 'user', 'submitDate', 'status']
    data = Order.objects.all()
    if not show_user:
        columns.remove('user')
    if not show_status:
        columns.remove('status')
    return jsonListGenerator(request = request, columns = columns, data = data, template = "json/order.json",
                             my_dict={"show_edit":show_edit,"show_status":show_status,"show_user":show_user},
                             default_filters=filters)
Esempio n. 5
0
def usersJson(request,filters={}):
    columns = ['pk', 'username', 'firstname', 'lastname','groups']
    data = User.objects.all()
    return jsonListGenerator(request = request, columns = columns, data = data, template = "json/users.json")
Esempio n. 6
0
def categoriesJson(request):
    columns = ['name']
    data = Category.objects
    return jsonListGenerator(request=request, columns=columns, data=data, template="json/categories.json")
Esempio n. 7
0
def deliveryJson(request):
    columns = ['pk', 'user']
    data = Good.objects.filter(status='W')
    my_dict = {'show_user': False, 'checkbox': True, 'show_status': False}
    return jsonListGenerator(request=request, columns=columns, data=data, my_dict=my_dict,
                             template="json/allgoods.json")
Esempio n. 8
0
def addJson(request):
    columns = ['pk', 'user']
    data = Good.objects.exclude(status='D')
    my_dict = {'show_user': False, 'checkbox': True, 'show_status': False, 'show_description': True}
    return jsonListGenerator(request=request, columns=columns, data=data, my_dict=my_dict,
                             template="json/allgoods.json")
Esempio n. 9
0
def allDamagedJson(request):
    columns = ["good__pk","good__user","good__category", "status","description"]
    data = Damaged.objects
    return jsonListGenerator(request=request, data=data, columns=columns, template="json/damaged.json")