Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

Commit 2af64cd

Browse files
author
Matt Griswold
committed
Merge branch 'FC-5501' into 'prep-release'
FC-5501: devicectl port autocomplete blank query loads first N ports with ips set See merge request fullctl/fullctl!305
2 parents 39e8402 + be8f6c6 commit 2af64cd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/fullctl/django/autocomplete/devicectl.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from dal import autocomplete
2+
from django.conf import settings
23
from django.utils import html
34

45
import fullctl.service_bridge.devicectl as devicectl
56
from fullctl.django.models.concrete import Organization
67

7-
88
class devicectl_port(autocomplete.Select2QuerySetView):
99
def get_queryset(self):
1010
try:
@@ -16,7 +16,14 @@ def get_queryset(self):
1616
return []
1717

1818
if not self.q:
19-
return []
19+
# with a blank query we load the first N ports with IPs
20+
return [
21+
o for o in devicectl.Port().objects(
22+
org_slug=org.slug,
23+
has_ips=1,
24+
limit=settings.AUTOCOMPLETE_NUM_BLANK_QUERY_RESULTS
25+
)
26+
]
2027

2128
qs = [o for o in devicectl.Port().objects(org_slug=org.slug, q=self.q)]
2229
return qs

src/fullctl/django/settings/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ def set_default_v1(self):
264264
"https://forms.clickup.com/14289126/f/dm276-8191/22BRHTR36S1XXC7FG7",
265265
)
266266

267+
# Number of results to return for blank query in autocomplete requests
268+
self.set_option("AUTOCOMPLETE_NUM_BLANK_QUERY_RESULTS", 10)
269+
267270
# eval from default.py file
268271
filename = os.path.join(os.path.dirname(__file__), "default.py")
269272
self.try_include(filename)

0 commit comments

Comments
 (0)