# coding=utf-8

from django.conf import settings

from rest_framework import serializers
from apps.activity.models import Activity


class ActivitySerializer(serializers.ModelSerializer):
    pic = serializers.SerializerMethodField()
    describe = serializers.SerializerMethodField()

    class Meta:
        model = Activity
        fields = ('branch_address', 'branch_name', 'branch_tel', 'describe', 'title', 'amount', 'pic', )

    def get_pic(self, obj):
        if obj.pic:
            return settings.MEDIA_URL + obj.pic
        return ''

    def get_describe(self, obj):
        return ''
