This repository was archived by the owner on Feb 17, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11from dal import autocomplete
2+ from django .conf import settings
23from django .utils import html
34
45import fullctl .service_bridge .devicectl as devicectl
56from fullctl .django .models .concrete import Organization
67
7-
88class 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
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments