pug - Jade templates django - Use captured url value in urls.py -


i have "static" javascript templates want serve django application. put them in static folder , that's it. problem here templates aren't static, jade(pyjade) templates need pre-compiled.
plan having templates inside sub-directory of app's templates dir, lets call jstemplates, , serve them urls.py file this:

... url(r'^jstemplates/(?p<template>.*)', templateview.as_view(template_name=<captured_name>)), ... 

but how can captured template name?

thinking better, suppose captured attribute won't available until view's instantiation made sub-class of templateview called jstemplateview.

class jstemplateview(templateview):     def get_template_names(self):         return "jstemplates/%s.jade" % self.kwargs['template'] 

and added corresponding line in urls.py url(r'^jstemplates/(?p<template>.*)', jstemplateview.as_view()


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -