From bcae1d09a863aaddeabe4fb4abce42635c8d1596 Mon Sep 17 00:00:00 2001 From: eeintech Date: Thu, 17 Dec 2020 17:25:10 -0500 Subject: [PATCH] Fixed category parameter templates settings view --- InvenTree/part/api.py | 4 ++-- InvenTree/templates/InvenTree/settings/category.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index 9bf7294335..b479575a35 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -130,7 +130,7 @@ class CategoryParameters(generics.ListAPIView): """ try: - cat_id = int(self.request.query_params.get('category', None)) + cat_id = int(self.kwargs.get('pk', None)) except TypeError: cat_id = None fetch_parent = str2bool(self.request.query_params.get('fetch_parent', 'true')) @@ -910,8 +910,8 @@ part_api_urls = [ # Base URL for PartCategory API endpoints url(r'^category/', include([ + url(r'^(?P\d+)/parameters/?', CategoryParameters.as_view(), name='api-part-category-parameters'), url(r'^(?P\d+)/?', CategoryDetail.as_view(), name='api-part-category-detail'), - url(r'^parameters/?', CategoryParameters.as_view(), name='api-part-category-parameters'), url(r'^$', CategoryList.as_view(), name='api-part-category-list'), ])), diff --git a/InvenTree/templates/InvenTree/settings/category.html b/InvenTree/templates/InvenTree/settings/category.html index c84573e8b4..07dd0df342 100644 --- a/InvenTree/templates/InvenTree/settings/category.html +++ b/InvenTree/templates/InvenTree/settings/category.html @@ -45,7 +45,7 @@ {% if category %} $("#param-table").inventreeTable({ - url: "{% url 'api-part-category-parameters' category.pk %}", + url: "{% url 'api-part-category-parameters' pk=category.pk %}", queryParams: { ordering: 'name', }, @@ -58,7 +58,7 @@ switchable: false, }, { - field: 'parameter_template_detail.name', + field: 'parameter_template.name', title: '{% trans "Parameter Template" %}', sortable: 'true', },