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
Commits
8cea5c2a
Commit
8cea5c2a
authored
5 years ago
by
Erwan Rouchet
Browse files
Options
Downloads
Patches
Plain Diff
Fix related elements type filter
parent
c38a3f49
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!555
Fix related elements type filter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex/documents/api/elements.py
+1
-1
1 addition, 1 deletion
arkindex/documents/api/elements.py
arkindex/documents/tests/test_elements_api.py
+15
-0
15 additions, 0 deletions
arkindex/documents/tests/test_elements_api.py
with
16 additions
and
1 deletion
arkindex/documents/api/elements.py
+
1
−
1
View file @
8cea5c2a
...
...
@@ -217,7 +217,7 @@ class RelatedElementsList(ListAPIView):
}
type_param
=
self
.
request
.
query_params
.
get
(
'
type
'
)
if
type_param
is
not
None
:
filtering
[
'
type
'
]
=
type_param
filtering
[
'
type
__slug
'
]
=
type_param
related
=
Element
.
objects
.
get_related
(
self
.
kwargs
[
'
pk
'
],
**
filtering
)
prefetch_related_objects
(
related
,
'
corpus
'
,
'
zone__image__server
'
)
return
related
...
...
This diff is collapsed.
Click to expand it.
arkindex/documents/tests/test_elements_api.py
+
15
−
0
View file @
8cea5c2a
...
...
@@ -809,6 +809,21 @@ class TestElementsAPI(FixtureAPITestCase):
}
])
def
test_related_elements
(
self
):
act
=
self
.
corpus
.
elements
.
get
(
name
=
'
Act 1
'
)
response
=
self
.
client
.
get
(
reverse
(
'
api:related-elements
'
,
kwargs
=
{
'
pk
'
:
str
(
act
.
id
)}))
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
self
.
assertListEqual
(
[
r
[
'
name
'
]
for
r
in
response
.
json
()[
'
results
'
]],
[
'
Volume 1
'
,
'
Surface A
'
]
)
response
=
self
.
client
.
get
(
reverse
(
'
api:related-elements
'
,
kwargs
=
{
'
pk
'
:
str
(
act
.
id
)})
+
'
?type=volume
'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
self
.
assertListEqual
(
[
r
[
'
name
'
]
for
r
in
response
.
json
()[
'
results
'
]],
[
'
Volume 1
'
]
)
def
test_create_metadata_verified
(
self
):
response
=
self
.
client
.
post
(
reverse
(
'
api:element-metadata
'
,
kwargs
=
{
'
pk
'
:
str
(
self
.
vol
.
id
)}))
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_403_FORBIDDEN
)
...
...
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