Commit ca2b837f authored by Matheus Miranda's avatar Matheus Miranda
Browse files

User SimpleUserSeriliazer on stats

parent a2019407
from rest_framework import serializers from rest_framework import serializers
from actstream.models import Action from actstream.models import Action
from courses.reports.serializers import UserStatsSerializer from courses.reports.serializers import UserStatsSerializer
from courses.serializers import SimpleUserSerializer
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
...@@ -25,7 +26,7 @@ class UserAccessSerializer(serializers.Serializer): ...@@ -25,7 +26,7 @@ class UserAccessSerializer(serializers.Serializer):
class GenericRelatedField(serializers.Field): class GenericRelatedField(serializers.Field):
def to_representation(self, value): def to_representation(self, value):
if isinstance(value, User): if isinstance(value, User):
return UserStatsSerializer(value).data return SimpleUserSerializer(value).data
if isinstance(value, Classroom): if isinstance(value, Classroom):
return BasicClassroomSerializer(value).data return BasicClassroomSerializer(value).data
return str(value) return str(value)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment