Skip to content

Commit

Permalink
Merge branch 'next3.0' into app-nist-cve-sync3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bminnix authored Aug 10, 2024
2 parents 9b72fb0 + 02bf22d commit 024ff55
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
fail-fast: true
matrix:
python-version: ["3.11"]
nautobot-version: ["2.0.0"]
nautobot-version: ["2.2.1"]
env:
INVOKE_NAUTOBOT_DEVICE_LIFECYCLE_MGMT_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_DEVICE_LIFECYCLE_MGMT_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
include:
- python-version: "3.11"
db-backend: "postgresql"
nautobot-version: "2.0.0"
nautobot-version: "2.2.1"
# - python-version: "3.11"
# db-backend: "mysql"
# nautobot-version: "stable"
Expand Down
1 change: 1 addition & 0 deletions changes/290.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated HardwareLCMFilterSet filter field names for compatibility with nautobot-ansible plugin module.
7 changes: 4 additions & 3 deletions nautobot_device_lifecycle_mgmt/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ class HardwareLCMFilterSet(NautobotFilterSet):
q = django_filters.CharFilter(method="search", label="Search")

device_type = django_filters.ModelMultipleChoiceFilter(
field_name="device_type", queryset=DeviceType.objects.all(), label="Device Type"
)

device_type_model = django_filters.ModelMultipleChoiceFilter(
field_name="device_type__model",
queryset=DeviceType.objects.all(),
to_field_name="model",
label="Device Type (Model)",
)
device_type_id = django_filters.ModelMultipleChoiceFilter(
field_name="device_type", queryset=DeviceType.objects.all(), label="Device Type"
)

inventory_item = django_filters.ModelMultipleChoiceFilter(
queryset=HardwareLCM.objects.exclude(inventory_item__isnull=True),
Expand Down
8 changes: 4 additions & 4 deletions nautobot_device_lifecycle_mgmt/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,22 @@ def test_documentation_url(self):

def test_device_type_name_single(self):
"""Test device_type filter."""
params = {"device_type": ["c9300-24"]}
params = {"device_type_model": ["c9300-24"]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)

def test_device_types_name_all(self):
"""Test device_type filter."""
params = {"device_type": ["c9300-24", "c9300-48"]}
params = {"device_type_model": ["c9300-24", "c9300-48"]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)

def test_device_types_id_single(self):
"""Test device_type_id filter."""
params = {"device_type_id": [self.device_types[0].id]}
params = {"device_type": [self.device_types[0].id]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)

def test_device_types_id_all(self):
"""Test device_type_id filter."""
params = {"device_type_id": [self.device_types[0].id, self.device_types[1].id]}
params = {"device_type": [self.device_types[0].id, self.device_types[1].id]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)

def test_devices_name_all(self):
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ netutils = ">=1.9.0"
Django = "<4.2"

[tool.poetry.group.dev.dependencies]
Django = "~3.2.25"
bandit = "*"
black = "*"
coverage = "*"
Expand Down Expand Up @@ -128,7 +129,7 @@ notes = """,

[tool.pylint-nautobot]
supported_nautobot_versions = [
"2.0.0"
"2.2.0"
]

[tool.ruff]
Expand Down

0 comments on commit 024ff55

Please sign in to comment.