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:
@ -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))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user