Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Merge requests
!1536
Filter by rotation_angle and mirroring
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Filter by rotation_angle and mirroring
list-filter-rotation-mirror
into
master
Overview
0
Commits
2
Pipelines
0
Changes
4
Merged
Erwan Rouchet
requested to merge
list-filter-rotation-mirror
into
master
3 years ago
Overview
0
Commits
2
Pipelines
0
Changes
4
Expand
Closes
#893 (closed)
Edited
3 years ago
by
Erwan Rouchet
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
33083434
2 commits,
3 years ago
4 files
+
265
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
arkindex/documents/api/elements.py
+
29
−
1
Options
@@ -181,6 +181,22 @@ class ElementsListAutoSchema(AutoSchema):
type
=
UUID
,
required
=
False
,
),
OpenApiParameter
(
'
rotation_angle
'
,
description
=
'
Restrict to elements with the given rotation angle.
'
,
type
=
{
'
type
'
:
'
integer
'
,
'
minimum
'
:
0
,
'
maximum
'
:
359
,
},
required
=
False
,
),
OpenApiParameter
(
'
mirrored
'
,
description
=
'
Restrict to or exclude mirrored elements.
'
,
type
=
bool
,
required
=
False
,
)
]
# Add method-specific parameters
@@ -450,9 +466,21 @@ class ElementsListBase(CorpusACLMixin, DestroyModelMixin, ListAPIView):
}
errors
=
{}
if
'
name
'
in
self
.
request
.
query
_params
:
if
'
name
'
in
self
.
clean
_params
:
filters
[
'
name__icontains
'
]
=
self
.
clean_params
[
'
name
'
]
if
'
rotation_angle
'
in
self
.
clean_params
:
try
:
rotation_angle
=
int
(
self
.
clean_params
[
'
rotation_angle
'
])
assert
0
<=
rotation_angle
<=
359
,
'
A rotation angle must be between 0 and 359 degrees
'
except
(
AssertionError
,
TypeError
,
ValueError
)
as
e
:
errors
[
'
rotation_angle
'
]
=
[
str
(
e
)]
else
:
filters
[
'
rotation_angle
'
]
=
rotation_angle
if
'
mirrored
'
in
self
.
clean_params
:
filters
[
'
mirrored
'
]
=
self
.
clean_params
[
'
mirrored
'
].
lower
()
not
in
(
'
false
'
,
'
0
'
)
if
self
.
type_filter
:
filters
[
'
type
'
]
=
self
.
type_filter
elif
self
.
folder_filter
is
not
None
:
Loading