2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 04:55:44 +00:00

Enable regex search (#4566)

* Adds custom search filter to allow 'regex' searching of results

* Specify if "shell" can access database for certain commands

* Bug fix for settings API

- Do not allow cache on detail endpoints
- Was causing strange error conditions with missing or duplicate PK values

* Adds user setting to control regex search

* Enable regex for search queries

- bootstrap tables
- search preview

* Pass search options through bettererer

* Refactor API endpoints to use new filter approach

* Bump API version

* Add "whole word" search

- Closes https://github.com/inventree/InvenTree/issues/4510

* Handle case where existing fields are empty

* pop > get
This commit is contained in:
Oliver
2023-04-04 07:05:55 +10:00
committed by GitHub
parent eef303dfea
commit d6715d94c1
19 changed files with 165 additions and 72 deletions

View File

@ -5,11 +5,12 @@ from django.core.exceptions import ObjectDoesNotExist
from django.urls import include, path, re_path
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters, permissions, status
from rest_framework import permissions, status
from rest_framework.authtoken.models import Token
from rest_framework.response import Response
from rest_framework.views import APIView
from InvenTree.filters import InvenTreeSearchFilter
from InvenTree.mixins import ListAPI, RetrieveAPI, RetrieveUpdateAPI
from InvenTree.serializers import UserSerializer
from users.models import Owner, RuleSet, check_user_role
@ -137,7 +138,7 @@ class UserList(ListAPI):
filter_backends = [
DjangoFilterBackend,
filters.SearchFilter,
InvenTreeSearchFilter,
]
search_fields = [
@ -168,7 +169,7 @@ class GroupList(ListAPI):
filter_backends = [
DjangoFilterBackend,
filters.SearchFilter,
InvenTreeSearchFilter,
]
search_fields = [