Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
RECIRCLE
/
portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
11
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
73c7887d
authored
Apr 06, 2020
by
Chif Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter owned templates and display system templates for everyone
parent
1a9a8829
Pipeline
#1046
failed with stage
in 1 minute 28 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
recircle/template/views.py
+3
-2
No files found.
recircle/template/views.py
View file @
73c7887d
...
...
@@ -3,6 +3,7 @@ from rest_framework.viewsets import ModelViewSet
from
template.serializers
import
ImageTemplateModelSerializer
,
ImageTemplateListItemSerializer
from
template.models
import
ImageTemplate
from
django.db.models
import
Q
class
ImageTemplateViewSet
(
ModelViewSet
):
...
...
@@ -41,7 +42,7 @@ class ImageTemplateViewSet(ModelViewSet):
return
super
(
ImageTemplateViewSet
,
self
)
.
update
(
request
,
partial
=
True
)
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
# TODO: Filter for
owned and
shared tempaltes
query
=
ImageTemplate
.
objects
.
all
(
)
# TODO: Filter for shared tempaltes
query
=
ImageTemplate
.
objects
.
filter
(
Q
(
created_by
=
request
.
user
.
id
)
|
Q
(
type
=
"SYSTEM"
)
)
serializer
=
ImageTemplateListItemSerializer
(
query
,
many
=
True
)
return
Response
(
serializer
.
data
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment