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
44e8d747
Commit
44e8d747
authored
Jul 18, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move logic into view.py for whether user is enrolled.
parent
5824b2eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
lms/djangoapps/courseware/views.py
+8
-3
lms/templates/portal/course_about.html
+3
-4
No files found.
lms/djangoapps/courseware/views.py
View file @
44e8d747
...
...
@@ -250,12 +250,17 @@ def course_info(request, course_id):
course
=
check_course
(
course_id
)
return
render_to_response
(
'info.html'
,
{
'course'
:
course
})
@ensure_csrf_cookie
def
course_about
(
request
,
course_id
):
def
registered_for_course
(
course
,
user
):
if
user
.
is_authenticated
():
return
CourseEnrollment
.
objects
.
filter
(
user
=
user
,
course_id
=
course
.
id
)
.
exists
()
else
:
return
False
course
=
check_course
(
course_id
,
course_must_be_open
=
False
)
return
render_to_response
(
'portal/course_about.html'
,
{
'course'
:
course
})
registered
=
registered_for_course
(
course
,
request
.
user
)
return
render_to_response
(
'portal/course_about.html'
,
{
'course'
:
course
,
'registered'
:
registered
})
@login_required
...
...
lms/templates/portal/course_about.html
View file @
44e8d747
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%!
from
student
.
models
import
CourseEnrollment
%
>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
block
name=
"js_extra"
>
<script
src=
"${static.url('js/course_info.js')}"
></script>
...
...
@@ -17,10 +16,10 @@
<div
class=
"main-cta"
>
%if user.is_authenticated():
%if not CourseEnrollment.objects.filter(user=user, course_id=course.id).exists():
<a
href=
"${reverse('enroll', args=[course.id])}"
class=
"register"
>
Register
</a>
%else:
%if registered:
<span
class=
"register disabled"
>
Registered
</span>
%else:
<a
href=
"${reverse('enroll', args=[course.id])}"
class=
"register"
>
Register
</a>
%endif
%else:
<a
href=
"#signup-modal"
class=
"register"
rel=
"leanModal"
data-notice=
"You must register in order to enroll"
>
Register
</a>
...
...
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