Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion inventree/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ def list(cls, api, **kwargs):
# Dict of query params to send to the API
params = kwargs

response = api.get(cls.URL, params=params, **kwargs)
# Check if custom URL is present in request arguments
if 'url' in kwargs:
url = kwargs.pop('url')
else:
url = cls.URL

response = api.get(url=url, params=params, **kwargs)

if response is None:
return None
Expand Down
11 changes: 4 additions & 7 deletions inventree/part.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,12 @@ def get_category_parameter_templates(self, fetch_parent=True):
"""
fetch_parent: enable to fetch templates for parent categories
"""
return CategoryParameterTemplate.list(self._api,
category=self.pk,
fetch_parent=fetch_parent)


class CategoryParameterTemplate(inventree.base.InventreeObject):
""" Class representing the PartCategoryParameterTemplate database model """
parameters_url = f'part/category/{self.pk}/parameters'

URL = 'part/category/parameters'
return self.list(self._api,
url=parameters_url,
fetch_parent=fetch_parent)


class Part(inventree.base.InventreeObject):
Expand Down