URL-parameters and logic in Django class-based views (TemplateView)

前端 未结 5 964
小蘑菇
小蘑菇 2020-11-28 22:32

It is unclear to me how it is best to access URL-parameters in class-based-views in Django 1.5.

Consider the following:

View:



        
5条回答
  •  情歌与酒
    2020-11-28 23:02

    To access the url parameters in class based views, use self.args or self.kwargs so you would access it by doing self.kwargs['year']

提交回复
热议问题