class NoteDetailView(DetailView):
""" Class-based view for the note html page """
-
# name passed to template
context_object_name = u"note"
model = Note
+
+class RawNoteDetailView(DetailView):
+ """ Class-based view for the raw note html for iframes """
+ template_name = u'notes/note_raw.html'
+ context_object_name = u"note"
+ model = Note
from karmaworld.apps.courses.models import Course
from karmaworld.apps.courses.views import CourseDetailView
-from karmaworld.apps.notes.views import NoteDetailView
+from karmaworld.apps.notes.views import NoteDetailView, RawNoteDetailView
# See: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#hooking-adminsite-instances-into-your-urlconf
admin.autodiscover()
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
- url(r'^about/$', direct_to_template, { 'template': 'about.html' }, name='about'),
+ url(r'^about/$', direct_to_template, { 'template': 'about.html' }, name='about'),
- url(r'^(?P<school_slug>[^/]+)/(?P<slug>[^/]+)$', CourseDetailView.as_view(), name='course_detail'),
- url(r'^(?P<school_slug>[^/]+)/(?P<course_slug>[^/]+)/(?P<slug>[^/]+)$', NoteDetailView.as_view(), name='note_detail'),
+ # the raw route must come before routes with a capture group after the
+ # first / of the url
+ url(r'^raw/(?P<pk>\d+)$', RawNoteDetailView.as_view(), name='note_raw'),
+ url(r'^(?P<school_slug>[^/]+)/(?P<slug>[^/]+)$', \
+ CourseDetailView.as_view(), name='course_detail'),
+ url(r'^(?P<school_slug>[^/]+)/(?P<course_slug>[^/]+)/(?P<slug>[^/]+)$', \
+ NoteDetailView.as_view(), name='note_detail'),
url(r'^$', ListView.as_view(model=Course), name='home'),
)