How to pass a variable from the url to a view in django?

前端 未结 4 398
忘了有多久
忘了有多久 2021-01-16 10:23

Simple question.

How can I pass a variable from the URL to the view? I\'m following the Date Example.

My view needs to arguments:

def hours_         


        
4条回答
  •  庸人自扰
    2021-01-16 11:12

    You could use Named groups in the regex

    (r'^plus/(?P\d{1,2})/$', hours_ahead),
    

提交回复
热议问题