from django.contrib.auth.models import User

from rest_framework import serializers

from competition.models import Team


class TeamSerializer(serializers.ModelSerializer):

    class Meta:
        model = Team
        fields = ('name', 'slug', 'url')

    url = serializers.SerializerMethodField('get_url')

    def get_url(self, obj):
        return obj.get_absolute_url()


class UserSerializer(serializers.ModelSerializer):

    class Meta:
        model = User
        fields = ('name', 'url')

    name = serializers.SerializerMethodField('get_name')
    url = serializers.SerializerMethodField('get_url')

    def get_name(self, obj):
        username = obj.username
        full_name = obj.get_full_name()
        if full_name:
            return u"{} ({})".format(username, full_name)
        return username

    def get_url(self, obj):
        return obj.get_absolute_url()

@@ -287,33 +287,38 @@
 MethodField(
-'get_url'
+read_only=True
 )%0A%0A    def g
@@ -548,18 +548,22 @@
 eld(
-'get_name'
+read_only=True
 )%0A  
@@ -608,17 +608,22 @@
 eld(
-'get_url'
+read_only=True
 )%0A%0A 

Fix SerializerMethodFields for API