From d19d24543877a892ed6762f6193ad2524b2b4cc4 Mon Sep 17 00:00:00 2001 From: Etzelia Date: Tue, 16 Oct 2018 22:32:12 -0500 Subject: [PATCH] IP Search Implemented a search field for the admin site --- admin.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/admin.py b/admin.py index abb8d91..a06e53e 100644 --- a/admin.py +++ b/admin.py @@ -27,15 +27,12 @@ class UserAdmin(BaseUserAdmin): deactivate_account.short_description = "Deactivate selected accounts" - - class PlayerAdmin(admin.ModelAdmin): search_fields = ["username", "uuid"] class ApplicationAdmin(admin.ModelAdmin): search_fields = ["username"] - #date_hierarchy = 'date' class TicketPriorityFilter(admin.SimpleListFilter): @@ -60,7 +57,6 @@ class TicketPriorityFilter(admin.SimpleListFilter): class TicketAdmin(admin.ModelAdmin): search_fields = ["player__username", "staff__username"] - #date_hierarchy = 'date' list_filter = (TicketPriorityFilter,) @@ -86,10 +82,13 @@ class WarningSeverityFilter(admin.SimpleListFilter): class WarningAdmin(admin.ModelAdmin): search_fields = ["player__username", "staff__username"] - #date_hierarchy = 'date' list_filter = (WarningSeverityFilter,) +class IPAdmin(admin.ModelAdmin): + search_fields = ["player__username", "ip"] + + try: admin.site.unregister(User) admin.site.register(User, UserAdmin) @@ -98,7 +97,7 @@ try: admin.site.register(Warning, WarningAdmin) admin.site.register(Ticket, TicketAdmin) admin.site.register(Player, PlayerAdmin) - admin.site.register(IP) + admin.site.register(IP, IPAdmin) admin.site.register(Alert) admin.site.register(Note) except admin.sites.AlreadyRegistered: