--- /dev/null
+from django.views.generic import DetailView
+from karmaworld.apps.courses.models import Course
+
+class CourseDetailView(DetailView):
+ """ Class-based view for the course html page """
+
+ # name passed to template
+ context_object_name = u"course"
+ model = Course
+
+
from django.contrib import admin
from django.conf.urls.defaults import patterns, include, url
-from django.views.generic import ListView
+from django.views.generic import ListView, DetailView
from karmaworld.apps.courses.models import Course
+from karmaworld.apps.courses.views import CourseDetailView
# See: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#hooking-adminsite-instances-into-your-urlconf
admin.autodiscover()
# Admin panel and documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
+
+ url(r'^/b/(?P<slug>[^/]+)$', CourseDetailView.as_view(), name='course_detail'),
+
url(r'^$', ListView.as_view(model=Course), name='home'),
)