# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

from rest_framework import serializers

from commonrepo.groups.models import Group
from commonrepo.users.models import User as User

from .models import GroupFileUpload

class GroupSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Group
        fields = ('url', 'name', 'creator', 'create_date', 'create_date','members','description')
        
class GroupSerializerV2(serializers.ModelSerializer):
    class Meta:
        model = Group
        fields = ('url', 'id', 'name', 'creator', 'create_date', 'create_date','members','description')

class GroupFileUploadSerializer(serializers.HyperlinkedModelSerializer):
    owner = serializers.SlugRelatedField(
        read_only=True,
        slug_field='id'
    )
    class Meta:
        model = GroupFileUpload
        read_only_fields = ('created', 'datafile', 'owner')

@@ -370,16 +370,22 @@
  ('url',
+ 'id',
  'name',

更新 API Groups v1, 新增 id 欄位以便直接取得 id