mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-19 06:22:16 +00:00
Improved handling of asset ID when searching
This commit is contained in:
@@ -22,7 +22,9 @@ class AssetList(LoginRequiredMixin, generic.ListView):
|
|||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
q = self.request.GET.get('q', "")
|
q = self.request.GET.get('q', "")
|
||||||
if len(q) >= 3:
|
if len(q) >= 3:
|
||||||
return self.model.objects.filter(Q(asset_id__icontains=q) | Q(description__icontains=q) | Q(comments__icontains=q))
|
return self.model.objects.filter(Q(asset_id__exact=q) | Q(description__icontains=q) | Q(comments__icontains=q))
|
||||||
|
elif q != "":
|
||||||
|
return self.model.objects.filter(Q(asset_id__exact=q))
|
||||||
else:
|
else:
|
||||||
return self.model.objects.all()
|
return self.model.objects.all()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user