Skip to content

Commit

Permalink
3716 | Changed code suggested in comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszkarykowski committed Mar 1, 2024
1 parent 089530f commit ac17fb6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ralph/back_office/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ class BackOfficeAssetAdmin(
]
multiadd_summary_fields = list_display

search_fields = ['=barcode', 'sn', 'hostname', 'invoice_no', 'order_no']
search_fields = ['barcode', 'sn', 'hostname', 'invoice_no', 'order_no']

def get_search_results(self, request, queryset, search_term):
queryset, use_distinct = super().get_search_results(request, queryset, search_term) # noqa
if 'barcode' in request.GET:
barcode = request.GET.get('barcode')
queryset = self.model.objects.filter(barcode__exact=barcode)
return queryset, use_distinct

list_filter = [
'barcode', 'status', 'imei', 'imei2', 'sn', 'model', 'purchase_order',
Expand Down

0 comments on commit ac17fb6

Please sign in to comment.