Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDE
nk20
Commits
ff187581
Commit
ff187581
authored
4 years ago
by
me5na7qbjqbrp
Browse files
Options
Downloads
Patches
Plain Diff
Remove useless blank lines and spaces in api app
parent
f02efd3b
No related branches found
No related tags found
1 merge request
!107
Beta
Pipeline
#8614
passed with warnings with stages
in 13 minutes and 13 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/api/serializers.py
+1
-0
1 addition, 0 deletions
apps/api/serializers.py
apps/api/viewsets.py
+1
-5
1 addition, 5 deletions
apps/api/viewsets.py
with
2 additions
and
5 deletions
apps/api/serializers.py
+
1
−
0
View file @
ff187581
...
@@ -6,6 +6,7 @@ from django.contrib.contenttypes.models import ContentType
...
@@ -6,6 +6,7 @@ from django.contrib.contenttypes.models import ContentType
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
rest_framework.serializers
import
ModelSerializer
from
rest_framework.serializers
import
ModelSerializer
class
UserSerializer
(
ModelSerializer
):
class
UserSerializer
(
ModelSerializer
):
"""
"""
REST API Serializer for Users.
REST API Serializer for Users.
...
...
This diff is collapsed.
Click to expand it.
apps/api/viewsets.py
+
1
−
5
View file @
ff187581
...
@@ -6,11 +6,8 @@ from django_filters.rest_framework import DjangoFilterBackend
...
@@ -6,11 +6,8 @@ from django_filters.rest_framework import DjangoFilterBackend
from
django.db.models
import
Q
from
django.db.models
import
Q
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
rest_framework.viewsets
import
ReadOnlyModelViewSet
,
ModelViewSet
from
rest_framework.viewsets
import
ReadOnlyModelViewSet
,
ModelViewSet
from
permission.backends
import
PermissionBackend
from
permission.backends
import
PermissionBackend
from
note_kfet.middlewares
import
get_current_session
from
note_kfet.middlewares
import
get_current_session
from
note.models
import
Alias
from
note.models
import
Alias
...
@@ -47,7 +44,6 @@ class ReadOnlyProtectedModelViewSet(ReadOnlyModelViewSet):
...
@@ -47,7 +44,6 @@ class ReadOnlyProtectedModelViewSet(ReadOnlyModelViewSet):
return
self
.
model
.
objects
.
filter
(
PermissionBackend
.
filter_queryset
(
user
,
self
.
model
,
"
view
"
)).
distinct
()
return
self
.
model
.
objects
.
filter
(
PermissionBackend
.
filter_queryset
(
user
,
self
.
model
,
"
view
"
)).
distinct
()
class
UserViewSet
(
ReadProtectedModelViewSet
):
class
UserViewSet
(
ReadProtectedModelViewSet
):
"""
"""
REST API View set.
REST API View set.
...
@@ -67,7 +63,7 @@ class UserViewSet(ReadProtectedModelViewSet):
...
@@ -67,7 +63,7 @@ class UserViewSet(ReadProtectedModelViewSet):
if
"
search
"
in
self
.
request
.
GET
:
if
"
search
"
in
self
.
request
.
GET
:
pattern
=
self
.
request
.
GET
[
"
search
"
]
pattern
=
self
.
request
.
GET
[
"
search
"
]
# We match first a user by its username, then if an alias is matched without normalization
# We match first a user by its username, then if an alias is matched without normalization
# And finally if the normalized pattern matches a normalized alias.
# And finally if the normalized pattern matches a normalized alias.
queryset
=
queryset
.
filter
(
queryset
=
queryset
.
filter
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment