Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
cp_video_dokku
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexandr Dzehil
cp_video_dokku
Commits
be56892f
Commit
be56892f
authored
Mar 16, 2023
by
Ilya Simonov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tag and categories to video serializer
parent
e298bb4a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
1 deletion
+21
-1
admin.cpython-39.pyc
apps/core/__pycache__/admin.cpython-39.pyc
+0
-0
serializers.cpython-39.pyc
apps/core/__pycache__/serializers.cpython-39.pyc
+0
-0
signals.cpython-39.pyc
apps/core/__pycache__/signals.cpython-39.pyc
+0
-0
utils.cpython-39.pyc
apps/core/__pycache__/utils.cpython-39.pyc
+0
-0
serializers.py
apps/core/serializers.py
+21
-1
No files found.
apps/core/__pycache__/admin.cpython-39.pyc
View file @
be56892f
No preview for this file type
apps/core/__pycache__/serializers.cpython-39.pyc
View file @
be56892f
No preview for this file type
apps/core/__pycache__/signals.cpython-39.pyc
View file @
be56892f
No preview for this file type
apps/core/__pycache__/utils.cpython-39.pyc
View file @
be56892f
No preview for this file type
apps/core/serializers.py
View file @
be56892f
from
rest_framework
import
serializers
from
.models
import
Video
from
.models
import
Video
,
Category
,
Tag
,
TagToObject
class
TagToObjectSerializer
(
serializers
.
ModelSerializer
):
id
=
serializers
.
CharField
(
source
=
'tag.id'
)
name
=
serializers
.
CharField
(
source
=
'tag.name'
)
class
Meta
:
model
=
TagToObject
fields
=
[
'id'
,
'name'
]
class
CategorySerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
Category
fields
=
[
'id'
,
'name'
]
class
VideoSerializer
(
serializers
.
ModelSerializer
):
categories
=
CategorySerializer
(
many
=
True
)
tags
=
TagToObjectSerializer
(
many
=
True
)
class
Meta
:
model
=
Video
fields
=
[
...
...
@@ -12,4 +30,6 @@ class VideoSerializer(serializers.ModelSerializer):
'description'
,
's3_file'
,
'thumbnail'
,
'categories'
,
'tags'
,
]
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