I have the following urls
url(r'^view/1$', View1.as_view(), name='view'),
url(r'^view/2$', View2.as_view(), name='view'),
url(r'^view/3$', View3.as_view(), name='view'),
and the views views
class View1(TemplateView):
pass
class View2(TemplateView):
pass
class View3(TemplateView):
pass
and my question is how to Dynamically get TemplateView based on a regular expression
i.e., I want something like
url(r'^view/(number)$', View(number).as_view(), name='view'),
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…