WIP: Aureplop/kpsul js refactor #501

Draft
delobell wants to merge 215 commits from aureplop/kpsul_js_refactor into master
Showing only changes of commit 8aa4fa2dce - Show all commits

View file

@ -1338,13 +1338,27 @@ def history_json(request):
opegroups_list.append(opegroup_dict)
return JsonResponse({ 'opegroups': opegroups_list })
@teamkfet_required
def kpsul_articles_data(request):
articles = (
Article.objects
.values('id', 'name', 'price', 'stock', 'category_id', 'category__name')
.filter(is_sold=True))
return JsonResponse({ 'articles': list(articles) })
.filter(is_sold=True)
.select_related('category'))
articlelist = []
for article in articles:
articlelist.append({
'id': article.id,
'name': article.name,
'price': article.price,
'stock': article.stock,
'category': {
'id': article.category.id,
'name': article.category.name,
}
})
return JsonResponse(articlelist, safe=False)
@teamkfet_required
def history(request):