Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
15
Issues
15
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
rpteam
rp
Commits
f7a20e81
Commit
f7a20e81
authored
Mar 20, 2019
by
Okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding documentation for undocumented fields
parent
55650dc0
Pipeline
#2512
passed with stages
in 3 minutes
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
apps/rp/api/serializers.py
apps/rp/api/serializers.py
+16
-2
No files found.
apps/rp/api/serializers.py
View file @
f7a20e81
...
@@ -3,6 +3,7 @@ from rest_framework import serializers
...
@@ -3,6 +3,7 @@ from rest_framework import serializers
from
taggit.managers
import
TaggableManager
from
taggit.managers
import
TaggableManager
from
rp.models
import
Article
from
rp.models
import
Article
class
TagListSerializer
(
serializers
.
Field
):
class
TagListSerializer
(
serializers
.
Field
):
class
Meta
:
class
Meta
:
model
=
TaggableManager
(
blank
=
True
)
model
=
TaggableManager
(
blank
=
True
)
...
@@ -12,9 +13,22 @@ class TagListSerializer(serializers.Field):
...
@@ -12,9 +13,22 @@ class TagListSerializer(serializers.Field):
return
[
tag
.
name
for
tag
in
obj
.
all
()]
return
[
tag
.
name
for
tag
in
obj
.
all
()]
return
obj
return
obj
class
ArticleSerializer
(
serializers
.
ModelSerializer
):
class
ArticleSerializer
(
serializers
.
ModelSerializer
):
tags
=
TagListSerializer
()
#: List of short tags to describe the article (eg. "Privacy", "Copyright")
tags
=
TagListSerializer
(
help_text
=
"""
List of short tags to describe the article (eg."Privacy", "Copyright").
Can also be a list of tags or an empty list.
"""
)
und_score_up
=
serializers
.
IntegerField
(
required
=
False
,
help_text
=
"This is used to increase the vote count by this value"
)
und_score_down
=
serializers
.
IntegerField
(
required
=
False
,
help_text
=
"This is used to decrease the vote count by this value"
)
class
Meta
:
class
Meta
:
model
=
Article
model
=
Article
fields
=
(
'id'
,
'url'
,
'title'
,
'tags'
,
'extracts'
,
'und_score_up'
,
'und_score_down'
)
fields
=
(
'id'
,
'url'
,
'title'
,
'tags'
,
'extracts'
,
'und_score_up'
,
'und_score_down'
)
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