@@ -8,6 +8,7 @@ from django.http import Http404
|
||||
|
||||
from xmodule.course_module import CourseDescriptor
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -29,7 +30,7 @@ def check_course(course_id, course_must_be_open=True, course_required=True):
|
||||
try:
|
||||
course_loc = CourseDescriptor.id_to_location(course_id)
|
||||
course = modulestore().get_item(course_loc)
|
||||
except KeyError:
|
||||
except (KeyError, ItemNotFoundError):
|
||||
raise Http404("Course not found.")
|
||||
|
||||
if course_must_be_open and not course.has_started():
|
||||
|
||||
@@ -33,14 +33,20 @@
|
||||
% for course in courses:
|
||||
|
||||
<article class="my-course">
|
||||
<a href="${reverse('info', args=[course.id])}" class="cover" style="background-image: url('${course_image_url(course)}')">
|
||||
<%
|
||||
if course.has_started():
|
||||
course_target = reverse('info', args=[course.id])
|
||||
else:
|
||||
course_target = reverse('about_course', args=[course.id])
|
||||
%>
|
||||
<a href="${course_target}" class="cover" style="background-image: url('${course_image_url(course)}')">
|
||||
<div class="shade"></div>
|
||||
<div class="arrow"></div>
|
||||
</a>
|
||||
<section class="info">
|
||||
<hgroup>
|
||||
<a href="#" class="university">${get_course_about_section(course, 'university')}</a>
|
||||
<h3><a href="${reverse('info', args=[course.id])}">${get_course_about_section(course, "title")}</a></h3>
|
||||
<h3><a href="${course_target}">${get_course_about_section(course, "title")}</a></h3>
|
||||
</hgroup>
|
||||
<section class="course-status">
|
||||
<p>Class Starts - <span>9/2/2012</span></div>
|
||||
|
||||
Reference in New Issue
Block a user