Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses
Commits
ca2b837f
Commit
ca2b837f
authored
Sep 22, 2020
by
Matheus Miranda
Browse files
User SimpleUserSeriliazer on stats
parent
a2019407
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
courses/stats/serializers.py
courses/stats/serializers.py
+2
-1
No files found.
courses/stats/serializers.py
View file @
ca2b837f
from
rest_framework
import
serializers
from
actstream.models
import
Action
from
courses.reports.serializers
import
UserStatsSerializer
from
courses.serializers
import
SimpleUserSerializer
from
django.contrib.auth.models
import
User
from
django.contrib.auth
import
get_user_model
...
...
@@ -25,7 +26,7 @@ class UserAccessSerializer(serializers.Serializer):
class
GenericRelatedField
(
serializers
.
Field
):
def
to_representation
(
self
,
value
):
if
isinstance
(
value
,
User
):
return
UserStats
Serializer
(
value
).
data
return
SimpleUser
Serializer
(
value
).
data
if
isinstance
(
value
,
Classroom
):
return
BasicClassroomSerializer
(
value
).
data
return
str
(
value
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment