Skip to content

Commit

Permalink
Merge pull request #3716 from lukaszkarykowski/search_fields_change_t…
Browse files Browse the repository at this point in the history
…o_exact

ITS-363398 | Search fields, search changed to find exact barcode
  • Loading branch information
awieckowski authored Mar 4, 2024
2 parents 685d65e + ac17fb6 commit d0b1e04
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ralph/back_office/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ class BackOfficeAssetAdmin(

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',
'hostname', 'required_support', 'region', 'warehouse', 'task_url',
Expand Down

0 comments on commit d0b1e04

Please sign in to comment.