# coding=utf-8

from rest_framework import serializers
from django.conf import settings
from .models import Upload


class UploadSerializer(serializers.ModelSerializer):
    user_text = serializers.CharField(source='user.name', read_only=True)
    create_time_f = serializers.DateTimeField(source='create_time', format=settings.SHORT_DATETIME_FORMAT,
                                              read_only=True)

    class Meta:
        model = Upload
        fields = ('picture', 'create_time_f', 'file_size', 'user_text')
