From f7a20e811c3d6654aa43649eb4e6dcc244059810 Mon Sep 17 00:00:00 2001 From: Okhin Date: Wed, 20 Mar 2019 15:45:54 +0100 Subject: [PATCH] Adding documentation for undocumented fields --- apps/rp/api/serializers.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/rp/api/serializers.py b/apps/rp/api/serializers.py index 1d29196..6b5ea6a 100644 --- a/apps/rp/api/serializers.py +++ b/apps/rp/api/serializers.py @@ -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') -- GitLab