Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
0f634bb6
Commit
0f634bb6
authored
May 08, 2015
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7971 from edx/will/verification-status-admin-updates
Updates to the verify student Django admin.
parents
58b34e1c
4f156dc0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
6 deletions
+44
-6
lms/djangoapps/verify_student/admin.py
+35
-6
lms/djangoapps/verify_student/models.py
+9
-0
No files found.
lms/djangoapps/verify_student/admin.py
View file @
0f634bb6
from
ratelimitbackend
import
admin
from
config_models.admin
import
ConfigurationModelAdmin
from
verify_student.models
import
(
SoftwareSecurePhotoVerification
,
InCourseReverificationConfiguration
,
VerificationStatus
VerificationStatus
,
SkippedReverification
,
)
...
...
@@ -20,12 +22,39 @@ class VerificationStatusAdmin(admin.ModelAdmin):
"""
Admin for the VerificationStatus table.
"""
list_display
=
(
'id'
,
'user'
,
'status'
,
'checkpoint'
,
'location_id'
)
search_fields
=
(
'checkpoint'
,
)
list_display
=
(
'timestamp'
,
'user'
,
'status'
,
'checkpoint'
,
'location_id'
)
readonly_fields
=
()
search_fields
=
(
'checkpoint'
,
'user'
)
def
get_readonly_fields
(
self
,
request
,
obj
=
None
):
"""When editing an existing record, all fields should be read-only.
VerificationStatus records should be immutable; to change the user's
status, create a new record with the updated status and a more
recent timestamp.
"""
if
obj
:
return
self
.
readonly_fields
+
(
'status'
,
'checkpoint'
,
'user'
,
'location_id'
,
'response'
,
'error'
)
return
self
.
readonly_fields
def
has_delete_permission
(
self
,
request
,
obj
=
None
):
"""The verification status table is append-only. """
return
False
class
SkippedReverificationAdmin
(
admin
.
ModelAdmin
):
"""Admin for the SkippedReverification table. """
list_display
=
(
'created_at'
,
'user'
,
'course_id'
,
'checkpoint'
)
readonly_fields
=
(
'user'
,
'course_id'
)
search_fields
=
(
'user'
,
'course_id'
,
'checkpoint'
)
def
has_add_permission
(
self
,
request
):
"""Skipped verifications can't be created in Django admin. """
return
False
admin
.
site
.
register
(
SoftwareSecurePhotoVerification
,
SoftwareSecurePhotoVerificationAdmin
)
admin
.
site
.
register
(
InCourseReverificationConfiguration
)
admin
.
site
.
register
(
InCourseReverificationConfiguration
,
ConfigurationModelAdmin
)
admin
.
site
.
register
(
SkippedReverification
,
SkippedReverificationAdmin
)
admin
.
site
.
register
(
VerificationStatus
,
VerificationStatusAdmin
)
lms/djangoapps/verify_student/models.py
View file @
0f634bb6
...
...
@@ -974,6 +974,13 @@ class VerificationCheckpoint(models.Model):
class
Meta
:
# pylint: disable=missing-docstring, old-style-class
unique_together
=
((
'course_id'
,
'checkpoint_name'
),)
def
__unicode__
(
self
):
"""Unicode representation of the checkpoint. """
return
u"{checkpoint} in {course}"
.
format
(
checkpoint
=
self
.
checkpoint_name
,
course
=
self
.
course_id
)
def
add_verification_attempt
(
self
,
verification_attempt
):
""" Add the verification attempt in M2M relation of photo_verification
...
...
@@ -1047,6 +1054,8 @@ class VerificationStatus(models.Model):
class
Meta
(
object
):
# pylint: disable=missing-docstring
get_latest_by
=
"timestamp"
verbose_name
=
"Verification Status"
verbose_name_plural
=
"Verification Statuses"
@classmethod
def
add_verification_status
(
cls
,
checkpoint
,
user
,
status
,
location_id
=
None
):
...
...
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