Parcourir la source

Add more field to item search

Jocelyn Delande il y a 9 ans
Parent
commit
d5f9ede93a
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      hardware_provisioning/admin.py

+ 4 - 1
hardware_provisioning/admin.py

@@ -17,7 +17,10 @@ class ItemAdmin(admin.ModelAdmin):
         'designation', 'type', 'mac_address', 'serial', 'owner',
         'buy_date', 'is_available')
     list_filter = ('type__name', 'buy_date', 'owner')
-    search_fields = ('designation', 'owner')
+    search_fields = (
+        'designation', 'mac_address', 'serial',
+        'owner__email', 'owner__nickname',
+        'owner__first_name', 'owner__last_name')
     actions = ['give_back']
 
     def give_back(self, request, queryset):