36 lines
986 B
Python
36 lines
986 B
Python
from django.http import HttpResponse
|
|
from .models import JournalEntry, Produit
|
|
from django.shortcuts import render
|
|
from django.http import JsonResponse
|
|
|
|
def index(request):
|
|
entry_list = JournalEntry.objects.order_by('entry_date')
|
|
context = {'entry_list': entry_list}
|
|
return render(request, 'journaldecaisse/index.html', context)
|
|
|
|
def vente(request):
|
|
product_list = Produit.objects.all().values_list()
|
|
products = []
|
|
for elem in product_list:
|
|
products.append(elem[1])
|
|
products = list(set(products))
|
|
|
|
|
|
context = {"product_list" : products}
|
|
return render(request, 'journaldecaisse/vente.html', context)
|
|
|
|
|
|
|
|
|
|
def iterate_options(request):
|
|
options_selected = request.GET.get('option', None)
|
|
options_selected = options_selected.split(":")
|
|
print(options_selected)
|
|
|
|
test = Produit.objects.filter(**{ options_selected[0] : options_selected[1] })
|
|
print(test)
|
|
|
|
data = {
|
|
'is_taken': None
|
|
}
|
|
return JsonResponse(data)
|