Merge pull request #1174 from eeintech/fix_category_parameter_url

Fixed category parameter templates settings view
This commit is contained in:
Oliver 2020-12-18 12:00:51 +11:00 committed by GitHub
commit d38d9b21a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -130,7 +130,7 @@ class CategoryParameters(generics.ListAPIView):
""" """
try: try:
cat_id = int(self.request.query_params.get('category', None)) cat_id = int(self.kwargs.get('pk', None))
except TypeError: except TypeError:
cat_id = None cat_id = None
fetch_parent = str2bool(self.request.query_params.get('fetch_parent', 'true')) fetch_parent = str2bool(self.request.query_params.get('fetch_parent', 'true'))
@ -910,8 +910,8 @@ part_api_urls = [
# Base URL for PartCategory API endpoints # Base URL for PartCategory API endpoints
url(r'^category/', include([ url(r'^category/', include([
url(r'^(?P<pk>\d+)/parameters/?', CategoryParameters.as_view(), name='api-part-category-parameters'),
url(r'^(?P<pk>\d+)/?', CategoryDetail.as_view(), name='api-part-category-detail'), url(r'^(?P<pk>\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'), url(r'^$', CategoryList.as_view(), name='api-part-category-list'),
])), ])),

View File

@ -45,7 +45,7 @@
{% if category %} {% if category %}
$("#param-table").inventreeTable({ $("#param-table").inventreeTable({
url: "{% url 'api-part-category-parameters' category.pk %}", url: "{% url 'api-part-category-parameters' pk=category.pk %}",
queryParams: { queryParams: {
ordering: 'name', ordering: 'name',
}, },
@ -58,7 +58,7 @@
switchable: false, switchable: false,
}, },
{ {
field: 'parameter_template_detail.name', field: 'parameter_template.name',
title: '{% trans "Parameter Template" %}', title: '{% trans "Parameter Template" %}',
sortable: 'true', sortable: 'true',
}, },