Commit f7a20e81 authored by okhin's avatar okhin 🚴

Adding documentation for undocumented fields

parent 55650dc0
Pipeline #2512 passed with stages
in 3 minutes
......@@ -3,6 +3,7 @@ from rest_framework import serializers
from taggit.managers import TaggableManager
from rp.models import Article
class TagListSerializer(serializers.Field):
class Meta:
model = TaggableManager(blank=True)
......@@ -12,9 +13,22 @@ class TagListSerializer(serializers.Field):
return [tag.name for tag in obj.all()]
return obj
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:
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')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment