adding CourseDetailView, route and placeholder template for course_detail view (aka...
authorSeth Woodworth <seth@sethish.com>
Wed, 9 Jan 2013 22:51:15 +0000 (17:51 -0500)
committerSeth Woodworth <seth@sethish.com>
Wed, 9 Jan 2013 22:51:15 +0000 (17:51 -0500)
karmaworld/apps/courses/views.py [new file with mode: 0644]
karmaworld/templates/courses/course_detail.html [new file with mode: 0644]
karmaworld/urls.py

diff --git a/karmaworld/apps/courses/views.py b/karmaworld/apps/courses/views.py
new file mode 100644 (file)
index 0000000..3be3dba
--- /dev/null
@@ -0,0 +1,11 @@
+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
+
+
diff --git a/karmaworld/templates/courses/course_detail.html b/karmaworld/templates/courses/course_detail.html
new file mode 100644 (file)
index 0000000..4f31910
--- /dev/null
@@ -0,0 +1 @@
+TODO: Course detail template
index 0903132486d06f8d42b6f9d914e83aacb0b72992..73b320a98c416fda5c4e673bd8e7999d914fc5fe 100644 (file)
@@ -1,8 +1,9 @@
 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()
@@ -13,5 +14,8 @@ urlpatterns = patterns('',
     # 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'),
 )