Skip to content

Commit ff0c4cc

Browse files
authored
admin: add missing search_fields definitions (#412)
1 parent 1d6b4f1 commit ff0c4cc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scionlab/admin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ class ISDAdmin(admin.ModelAdmin):
184184
list_display = ('isd_id', 'label',)
185185
list_editable = ('label',)
186186
ordering = ['isd_id']
187+
search_fields = ('isd_id', 'label')
187188

188189
def get_readonly_fields(self, request, obj):
189190
"""
@@ -228,6 +229,7 @@ class HostAdminMixin:
228229
HostInline (the ModelInline for Host in ASAdmin).
229230
This is simply a bag of methods that can be used in readonly_fields/list_display.
230231
"""
232+
231233
def latest_config_deployed(self, obj):
232234
return not obj.needs_config_deployment()
233235

@@ -589,6 +591,7 @@ class VPNAdmin(admin.ModelAdmin):
589591
actions = ['update_key']
590592
list_display = ('__str__', 'server', 'subnet', 'server_vpn_ip', 'num_clients')
591593
list_display_links = ('__str__',)
594+
search_fields = ('subnet', 'server__label', 'server__AS__label', 'server__AS__as_id')
592595

593596
def get_form(self, request, obj=None, **kwargs):
594597
"""
@@ -618,6 +621,7 @@ class VPNClientAdmin(admin.ModelAdmin):
618621
list_display = ('__str__', 'vpn', 'ip', 'common_name')
619622
list_display_links = ('__str__',)
620623
list_filter = ('vpn', 'active')
624+
search_fields = ('host__label', 'host__AS__label', 'host__AS__as_id', 'host__AS__owner__email')
621625

622626
def get_form(self, request, obj=None, **kwargs):
623627
"""
@@ -718,6 +722,8 @@ class LinkAdmin(admin.ModelAdmin):
718722
list_display = ('__str__', 'type', 'active', 'public_ip_a', 'public_port_a', 'bind_ip_a',
719723
'public_ip_b', 'public_port_b', 'bind_ip_b',)
720724
list_filter = ('type', 'active', 'interfaceA__AS', 'interfaceB__AS',)
725+
search_fields = ('interfaceA__AS__as_id', 'interfaceA__AS__label', 'interfaceA__host__label',
726+
'interfaceB__AS__as_id', 'interfaceB__AS__label', 'interfaceB__host__label')
721727

722728
def public_ip_a(self, obj):
723729
return obj.interfaceA.get_public_ip()
@@ -746,6 +752,7 @@ class HostAdmin(HostAdminMixin, admin.ModelAdmin):
746752
'internal_ip', 'public_ip', 'bind_ip', 'ssh_host',
747753
'latest_config_deployed', 'get_scionlab_config_cmd', 'get_config_link')
748754
list_filter = ('AS__isd', 'AS', )
755+
search_fields = ('AS__as_id', 'label', 'ssh_host')
749756
ordering = ['AS']
750757

751758
def get_urls(self):

0 commit comments

Comments
 (0)