Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
e41d6143
Commit
e41d6143
authored
Mar 06, 2017
by
Awais
Committed by
Bill DeRusha
Mar 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding comments in forms and mixins.
parent
ef6f0659
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
course_discovery/apps/publisher/views.py
+10
-0
No files found.
course_discovery/apps/publisher/views.py
View file @
e41d6143
...
@@ -50,6 +50,13 @@ class Dashboard(mixins.LoginRequiredMixin, ListView):
...
@@ -50,6 +50,13 @@ class Dashboard(mixins.LoginRequiredMixin, ListView):
default_published_days
=
30
default_published_days
=
30
def
get_queryset
(
self
):
def
get_queryset
(
self
):
""" On dashboard courses are divided in multiple categories.
Publisher admin can view all these courses.
Internal users can see the assigned courses with roles only.
Users can see the courses if they are part of any group and that group has associated
with any organization and organization is part of a course and permissions are assigned
to the organization
"""
user
=
self
.
request
.
user
user
=
self
.
request
.
user
if
is_publisher_admin
(
user
):
if
is_publisher_admin
(
user
):
course_runs
=
CourseRun
.
objects
.
select_related
(
'course'
)
.
all
()
course_runs
=
CourseRun
.
objects
.
select_related
(
'course'
)
.
all
()
...
@@ -69,6 +76,7 @@ class Dashboard(mixins.LoginRequiredMixin, ListView):
...
@@ -69,6 +76,7 @@ class Dashboard(mixins.LoginRequiredMixin, ListView):
return
course_runs
return
course_runs
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
""" Courses lists are further divided into different categories."""
context
=
super
(
Dashboard
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
Dashboard
,
self
)
.
get_context_data
(
**
kwargs
)
course_runs
=
context
.
get
(
'object_list'
)
course_runs
=
context
.
get
(
'object_list'
)
published_course_runs
=
course_runs
.
filter
(
published_course_runs
=
course_runs
.
filter
(
...
@@ -125,6 +133,8 @@ class CourseRunDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionM
...
@@ -125,6 +133,8 @@ class CourseRunDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionM
course_run
=
CourseRunWrapper
(
self
.
get_object
())
course_run
=
CourseRunWrapper
(
self
.
get_object
())
context
[
'object'
]
=
course_run
context
[
'object'
]
=
course_run
context
[
'comment_object'
]
=
course_run
context
[
'comment_object'
]
=
course_run
# this ulr is used for the comments post back redirection.
context
[
'post_back_url'
]
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
})
context
[
'post_back_url'
]
=
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
})
context
[
'can_edit'
]
=
mixins
.
check_course_organization_permission
(
context
[
'can_edit'
]
=
mixins
.
check_course_organization_permission
(
...
...
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