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
413f8bb8
Commit
413f8bb8
authored
Jul 27, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Miniture staff dashboard. Not really tested, but should be safe to merge
parent
b7d3f5ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
lms/djangoapps/dashboard/views.py
+29
-0
lms/urls.py
+1
-0
No files found.
lms/djangoapps/dashboard/views.py
0 → 100644
View file @
413f8bb8
# Create your views here.
import
json
from
datetime
import
datetime
from
django.http
import
HttpResponse
,
Http404
def
dictfetchall
(
cursor
):
'''Returns all rows from a cursor as a dict.
Borrowed from Django documentation'''
desc
=
cursor
.
description
return
[
dict
(
zip
([
col
[
0
]
for
col
in
desc
],
row
))
for
row
in
cursor
.
fetchall
()
]
def
dashboard
(
request
):
"""
Simple view that a loadbalancer can check to verify that the app is up
"""
if
not
request
.
user
.
is_staff
:
raise
Http404
query
=
"select count(user_id) as students, course_id from student_courseenrollment group by course_id order by students desc"
from
django.db
import
connection
cursor
=
connection
.
cursor
()
results
=
dictfetchall
(
cursor
.
execute
(
query
))
return
HttpResponse
(
json
.
dumps
(
results
,
indent
=
4
))
lms/urls.py
View file @
413f8bb8
...
@@ -13,6 +13,7 @@ if settings.DEBUG:
...
@@ -13,6 +13,7 @@ if settings.DEBUG:
urlpatterns
=
(
''
,
urlpatterns
=
(
''
,
url
(
r'^$'
,
'student.views.index'
,
name
=
"root"
),
# Main marketing page, or redirect to courseware
url
(
r'^$'
,
'student.views.index'
,
name
=
"root"
),
# Main marketing page, or redirect to courseware
url
(
r'^dashboard$'
,
'student.views.dashboard'
,
name
=
"dashboard"
),
url
(
r'^dashboard$'
,
'student.views.dashboard'
,
name
=
"dashboard"
),
url
(
r'^admin_dashboard$'
,
'dashboard.views.dashboard'
),
url
(
r'^change_email$'
,
'student.views.change_email_request'
),
url
(
r'^change_email$'
,
'student.views.change_email_request'
),
url
(
r'^email_confirm/(?P<key>[^/]*)$'
,
'student.views.confirm_email_change'
),
url
(
r'^email_confirm/(?P<key>[^/]*)$'
,
'student.views.confirm_email_change'
),
...
...
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