Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-proctoring
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
edx-proctoring
Commits
084b9507
Commit
084b9507
authored
Jul 09, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the UserSerializer
parent
ae47a13d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
edx_proctoring/serializers.py
+42
-0
edx_proctoring/static/proctoring/templates/course_allowances.underscore
+6
-2
edx_proctoring/views.py
+0
-1
No files found.
edx_proctoring/serializers.py
View file @
084b9507
"""Defines serializers used by the Proctoring API."""
"""Defines serializers used by the Proctoring API."""
from
rest_framework
import
serializers
from
rest_framework
import
serializers
from
django.contrib.auth.models
import
User
from
edx_proctoring.models
import
ProctoredExam
,
ProctoredExamStudentAttempt
,
ProctoredExamStudentAllowance
from
edx_proctoring.models
import
ProctoredExam
,
ProctoredExamStudentAttempt
,
ProctoredExamStudentAllowance
...
@@ -16,6 +17,21 @@ class StrictBooleanField(serializers.BooleanField):
...
@@ -16,6 +17,21 @@ class StrictBooleanField(serializers.BooleanField):
return
None
return
None
class
UserSerializer
(
serializers
.
ModelSerializer
):
"""
"""
class
Meta
:
"""
Meta Class
"""
model
=
User
fields
=
(
"id"
,
"username"
,
"email"
)
class
ProctoredExamSerializer
(
serializers
.
ModelSerializer
):
class
ProctoredExamSerializer
(
serializers
.
ModelSerializer
):
"""
"""
Serializer for the ProctoredExam Model.
Serializer for the ProctoredExam Model.
...
@@ -42,6 +58,25 @@ class ProctoredExamSerializer(serializers.ModelSerializer):
...
@@ -42,6 +58,25 @@ class ProctoredExamSerializer(serializers.ModelSerializer):
)
)
class
UserSerializer
(
serializers
.
ModelSerializer
):
"""
Serializer for the User Model.
"""
id
=
serializers
.
IntegerField
(
required
=
False
)
username
=
serializers
.
CharField
(
required
=
True
)
email
=
serializers
.
CharField
(
required
=
True
)
class
Meta
:
"""
Meta Class
"""
model
=
User
fields
=
(
"id"
,
"username"
,
"email"
)
class
ProctoredExamStudentAttemptSerializer
(
serializers
.
ModelSerializer
):
class
ProctoredExamStudentAttemptSerializer
(
serializers
.
ModelSerializer
):
"""
"""
Serializer for the ProctoredExamStudentAttempt Model.
Serializer for the ProctoredExamStudentAttempt Model.
...
@@ -65,6 +100,7 @@ class ProctoredExamStudentAllowanceSerializer(serializers.ModelSerializer):
...
@@ -65,6 +100,7 @@ class ProctoredExamStudentAllowanceSerializer(serializers.ModelSerializer):
Serializer for the ProctoredExamStudentAllowance Model.
Serializer for the ProctoredExamStudentAllowance Model.
"""
"""
proctored_exam
=
ProctoredExamSerializer
()
proctored_exam
=
ProctoredExamSerializer
()
user
=
serializers
.
SerializerMethodField
(
'get_user'
)
class
Meta
:
class
Meta
:
"""
"""
...
@@ -74,3 +110,9 @@ class ProctoredExamStudentAllowanceSerializer(serializers.ModelSerializer):
...
@@ -74,3 +110,9 @@ class ProctoredExamStudentAllowanceSerializer(serializers.ModelSerializer):
fields
=
(
fields
=
(
"id"
,
"created"
,
"modified"
,
"user"
,
"key"
,
"value"
,
"proctored_exam"
"id"
,
"created"
,
"modified"
,
"user"
,
"key"
,
"value"
,
"proctored_exam"
)
)
def
get_user
(
self
,
allowance_object
):
"""
returns the user object in a serialized form
"""
return
UserSerializer
(
User
.
objects
.
get
(
id
=
allowance_object
.
user_id
))
.
data
edx_proctoring/static/proctoring/templates/course_allowances.underscore
View file @
084b9507
...
@@ -26,8 +26,12 @@
...
@@ -26,8 +26,12 @@
<td>
<td>
<%- interpolate(gettext(' %(exam_display_name)s '), { exam_display_name: proctored_exam_allowance.proctored_exam.exam_name }, true) %>
<%- interpolate(gettext(' %(exam_display_name)s '), { exam_display_name: proctored_exam_allowance.proctored_exam.exam_name }, true) %>
</td>
</td>
<td> Dummy Username </td>
<td>
<td>muhammad.shoaib@gmail.com</td>
<%- interpolate(gettext(' %(username)s '), { username: proctored_exam_allowance.user.username }, true) %>
</td>
<td>
<%- interpolate(gettext(' %(email)s '), { email: proctored_exam_allowance.user.email }, true) %>
</td>
<td>
<td>
<%- interpolate(gettext(' %(allowance_name)s '), { allowance_name: proctored_exam_allowance.key }, true) %>
<%- interpolate(gettext(' %(allowance_name)s '), { allowance_name: proctored_exam_allowance.key }, true) %>
</td>
</td>
...
...
edx_proctoring/views.py
View file @
084b9507
...
@@ -372,7 +372,6 @@ class ExamAllowanceView(AuthenticatedAPIView):
...
@@ -372,7 +372,6 @@ class ExamAllowanceView(AuthenticatedAPIView):
"""
"""
HTTP GET handler. Get all allowances for a course.
HTTP GET handler. Get all allowances for a course.
"""
"""
result_set
=
get_allowances_for_course
(
result_set
=
get_allowances_for_course
(
course_id
=
course_id
course_id
=
course_id
)
)
...
...
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