2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 13:35:40 +00:00

Implemented bidirectional traversal for PART and STOCK apps

- Added list view for StockItems
This commit is contained in:
Oliver
2018-04-14 15:13:16 +10:00
parent e30a089c76
commit 89ee09b01f
15 changed files with 157 additions and 38 deletions

View File

@ -22,16 +22,20 @@ def index(request):
cat_id = request.GET['category']
cat = get_object_or_404(PartCategory, pk=cat_id)
#cat = PartCategory.objects.get(pk=cat_id)
parts = parts.filter(category = cat_id)
children = PartCategory.objects.filter(parent = cat_id)
else:
parts = parts.filter(category__isnull=True)
children = PartCategory.objects.filter(parent__isnull=True)
context = {
'parts' : parts.order_by('category__name'),
'category' : cat,
'children' : children,
}
if cat:
context['category'] = cat
return HttpResponse(template.render(context, request))