remove permision from UserViewSet
This commit is contained in:
@@ -44,9 +44,6 @@ class UserViewSet(ModelViewSet):
|
|||||||
""" Crud operations for user model """
|
""" Crud operations for user model """
|
||||||
queryset = User.objects.all()
|
queryset = User.objects.all()
|
||||||
serializer_class = UserSerializer
|
serializer_class = UserSerializer
|
||||||
permission_classes = [
|
|
||||||
auth_permissions.CreateUser,
|
|
||||||
]
|
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
|
|||||||
@@ -24,8 +24,11 @@ class PaginatedElasticSearchApiView(APIView, LimitOffsetPagination):
|
|||||||
def get(self, request, query):
|
def get(self, request, query):
|
||||||
try:
|
try:
|
||||||
q = self.generate_q_expression(query)
|
q = self.generate_q_expression(query)
|
||||||
|
print(q)
|
||||||
search = self.document_class.search().query(q)
|
search = self.document_class.search().query(q)
|
||||||
|
print(search)
|
||||||
response = search.execute()
|
response = search.execute()
|
||||||
|
print(response)
|
||||||
|
|
||||||
print(f"Found {response.hits.total.value} hit(s) for query: '{query}'")
|
print(f"Found {response.hits.total.value} hit(s) for query: '{query}'")
|
||||||
|
|
||||||
@@ -59,3 +62,12 @@ class SearchUserDocumentApiView(PaginatedElasticSearchApiView):
|
|||||||
],
|
],
|
||||||
minimum_should_match=1,
|
minimum_should_match=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# return Q(
|
||||||
|
# "multi_match",
|
||||||
|
# query=query,
|
||||||
|
# fields=[
|
||||||
|
# "user__username"
|
||||||
|
# ],
|
||||||
|
# fuzziness='auto'
|
||||||
|
# )
|
||||||
|
|||||||
Reference in New Issue
Block a user