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

from rest_framework import serializers

from commonrepo.users.models import User as User

from commonrepo.elos.models import ELO
from commonrepo.snippets_api.models import Snippet
                  
class UserSerializer(serializers.HyperlinkedModelSerializer):
    snippets = serializers.HyperlinkedRelatedField(queryset=Snippet.objects.all(), view_name='snippet-detail', many=True)
    elos = serializers.HyperlinkedRelatedField(queryset=ELO.objects.all(), view_name='elos:elos-detail', many=True)

    class Meta:
        model = User
        fields = ('url', 'username', 'snippets', 'elos')

@@ -340,23 +340,19 @@
 r):%0A    
-snippet
+elo
 s = seri
@@ -392,23 +392,19 @@
 ueryset=
-Snippet
+ELO
 .objects
@@ -422,23 +422,25 @@
 w_name='
-snippet
+elos:elos
 -detail'
@@ -452,27 +452,31 @@
 y=True)%0A    
-elo
+snippet
 s = serializ
@@ -504,35 +504,39 @@
 dField(queryset=
-ELO
+Snippet
 .objects.all(), 
@@ -542,33 +542,31 @@
  view_name='
-elos:elos
+snippet
 -detail', ma
@@ -648,16 +648,24 @@
 ername',
+ 'elos',
  'snippe
@@ -669,16 +669,10 @@
 ppets', 
-'elos'
 )%0A

修正 users API 的顯示內容，優先顯示 ELO 的資訊