Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
[admin] Added search fields and list displays
Browse files Browse the repository at this point in the history
Implements and closes #17
  • Loading branch information
anurag-ks committed Jul 18, 2018
1 parent 99954e4 commit 17449e0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions django_ipam/base/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class AbstractSubnetAdmin(TimeReadonlyAdminMixin, ModelAdmin):
change_form_template = "admin/django-ipam/subnet/change_form.html"
change_list_template = "admin/django-ipam/subnet/change_list.html"
app_name = "django_ipam"
list_display = ('subnet', 'name', 'master_subnet', 'description')
search_fields = ['subnet', 'name']

def change_view(self, request, object_id, form_url="", extra_context=None):
instance = Subnet.objects.get(pk=object_id)
Expand Down Expand Up @@ -111,6 +113,9 @@ def __init__(self, *args, **kwargs):
class AbstractIpAddressAdmin(TimeReadonlyAdminMixin, ModelAdmin):
form = IpAddressAdminForm
change_form_template = "admin/django-ipam/ip_address/change_form.html"
list_display = ('ip_address', 'subnet', 'description')
list_filter = ('subnet',)
search_fields = ['ip_address']

class Media:
js = ('django-ipam/js/ip-request.js',)
Expand Down

0 comments on commit 17449e0

Please sign in to comment.