Put framework for both the navigation and crawlable feeds

pull/1/head
Raymond Yee 2014-06-20 16:53:25 -04:00
parent 2c48bb2bb9
commit e3f32da12b
2 changed files with 11 additions and 0 deletions

View File

@ -39,6 +39,7 @@ from regluit.frontend.views import (
MARCUngluifyView,
MARCConfigView,
DownloadView,
OPDSNavigationView,
)
urlpatterns = patterns(
@ -153,6 +154,8 @@ urlpatterns = patterns(
url(r"^marc/ungluify/$", staff_member_required(MARCUngluifyView.as_view()), name="MARCUngluify"),
url(r"^marc/concatenate/$", "marc_concatenate", name="marc_concatenate"),
url(r"^accounts/edit/marc_config/$", login_required(MARCConfigView.as_view()), name="marc_config"),
url(r"^opds/$", OPDSNavigationView.as_view(template_name="opds.xml"), name="opds"),
url(r"^opds/crawlable$", TemplateView.as_view(template_name="opds_crawlable.html"), name="opds_crawlable")
)
if settings.DEBUG:

View File

@ -3166,4 +3166,12 @@ def marc_concatenate(request):
outfile.write('</collection>')
return outfile
class OPDSNavigationView(TemplateView):
# http://stackoverflow.com/a/6867976
def render_to_response(self, context, **response_kwargs):
response_kwargs['content_type'] = "application/atom+xml;profile=opds-catalog;kind=navigation"
return super(TemplateView, self).render_to_response(context, **response_kwargs)