Skip to content
Snippets Groups Projects
Commit 24e40f42 authored by Stauros Kroustouris's avatar Stauros Kroustouris
Browse files

add search field in admin

parent 231de10c
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ from accounts.models import UserProfile
class UserPrAdmin(admin.ModelAdmin):
search_fields = ['user__username', 'peer__peer_name']
list_display = ('user', 'peer')
admin.site.register(UserProfile, UserPrAdmin)
......
......@@ -32,6 +32,7 @@ from longerusername.forms import UserCreationForm, UserChangeForm
class RouteAdmin(admin.ModelAdmin):
form = RouteForm
actions = ['deactivate']
search_fields = ['destination', 'name', 'applier__username']
def deactivate(self, request, queryset):
queryset = queryset.filter(status='ACTIVE')
......@@ -68,6 +69,7 @@ class UserProfileInline(admin.StackedInline):
class UserProfileAdmin(UserAdmin):
search_fields = ['username']
add_form = UserCreationForm
form = UserChangeForm
actions = ['deactivate', 'activate']
......
......@@ -43,8 +43,18 @@ class PeerAdminForm(ModelForm):
class PeerAdmin(admin.ModelAdmin):
search_fields = ['peer_name', 'networks__network']
form = PeerAdminForm
class PeerRangeAdmin(admin.ModelAdmin):
search_fields = ['network']
class TechcEmailAdmin(admin.ModelAdmin):
search_fields = ['email']
admin.site.register(Peer, PeerAdmin)
admin.site.register(PeerRange)
admin.site.register(TechcEmail)
admin.site.register(PeerRange, PeerRangeAdmin)
admin.site.register(TechcEmail, TechcEmailAdmin)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment