Add a field to ArticleSerializer in testproj for coverage.

openapi3
h-hirokawa 2017-12-18 19:31:32 +09:00
parent 8a0d5a964d
commit 16b697b40d
2 changed files with 6 additions and 1 deletions

View File

@ -9,10 +9,12 @@ class ArticleSerializer(serializers.ModelSerializer):
child=serializers.URLField(help_text="but i needed to test these 2 fields somehow"), child=serializers.URLField(help_text="but i needed to test these 2 fields somehow"),
) )
uuid = serializers.UUIDField(help_text="should articles have UUIDs?") uuid = serializers.UUIDField(help_text="should articles have UUIDs?")
cover_name = serializers.FileField(use_url=False, source='cover', read_only=True)
class Meta: class Meta:
model = Article model = Article
fields = ('title', 'body', 'slug', 'date_created', 'date_modified', 'references', 'uuid', 'cover') fields = ('title', 'body', 'slug', 'date_created', 'date_modified',
'references', 'uuid', 'cover', 'cover_name')
read_only_fields = ('date_created', 'date_modified', 'cover') read_only_fields = ('date_created', 'date_modified', 'cover')
lookup_field = 'slug' lookup_field = 'slug'
extra_kwargs = {'body': {'help_text': 'body serializer help_text'}} extra_kwargs = {'body': {'help_text': 'body serializer help_text'}}

View File

@ -497,6 +497,9 @@ definitions:
type: string type: string
format: uri format: uri
readOnly: true readOnly: true
cover_name:
type: string
readOnly: true
Project: Project:
required: required:
- project_name - project_name