IP Search

Implemented a search field for the admin site
reminder
Etzelia 2018-10-16 22:32:12 -05:00
parent 1440c6fa09
commit d19d245438
1 changed files with 5 additions and 6 deletions

View File

@ -27,15 +27,12 @@ class UserAdmin(BaseUserAdmin):
deactivate_account.short_description = "Deactivate selected accounts" deactivate_account.short_description = "Deactivate selected accounts"
class PlayerAdmin(admin.ModelAdmin): class PlayerAdmin(admin.ModelAdmin):
search_fields = ["username", "uuid"] search_fields = ["username", "uuid"]
class ApplicationAdmin(admin.ModelAdmin): class ApplicationAdmin(admin.ModelAdmin):
search_fields = ["username"] search_fields = ["username"]
#date_hierarchy = 'date'
class TicketPriorityFilter(admin.SimpleListFilter): class TicketPriorityFilter(admin.SimpleListFilter):
@ -60,7 +57,6 @@ class TicketPriorityFilter(admin.SimpleListFilter):
class TicketAdmin(admin.ModelAdmin): class TicketAdmin(admin.ModelAdmin):
search_fields = ["player__username", "staff__username"] search_fields = ["player__username", "staff__username"]
#date_hierarchy = 'date'
list_filter = (TicketPriorityFilter,) list_filter = (TicketPriorityFilter,)
@ -86,10 +82,13 @@ class WarningSeverityFilter(admin.SimpleListFilter):
class WarningAdmin(admin.ModelAdmin): class WarningAdmin(admin.ModelAdmin):
search_fields = ["player__username", "staff__username"] search_fields = ["player__username", "staff__username"]
#date_hierarchy = 'date'
list_filter = (WarningSeverityFilter,) list_filter = (WarningSeverityFilter,)
class IPAdmin(admin.ModelAdmin):
search_fields = ["player__username", "ip"]
try: try:
admin.site.unregister(User) admin.site.unregister(User)
admin.site.register(User, UserAdmin) admin.site.register(User, UserAdmin)
@ -98,7 +97,7 @@ try:
admin.site.register(Warning, WarningAdmin) admin.site.register(Warning, WarningAdmin)
admin.site.register(Ticket, TicketAdmin) admin.site.register(Ticket, TicketAdmin)
admin.site.register(Player, PlayerAdmin) admin.site.register(Player, PlayerAdmin)
admin.site.register(IP) admin.site.register(IP, IPAdmin)
admin.site.register(Alert) admin.site.register(Alert)
admin.site.register(Note) admin.site.register(Note)
except admin.sites.AlreadyRegistered: except admin.sites.AlreadyRegistered: