How does django parse url queries?

前端 未结 2 1060
深忆病人
深忆病人 2021-01-25 12:13

How do django views parse url queries? For example, suppose I have a view that lists all of the users at

localhost:8000/users/

If I wanted to

相关标签:
2条回答
  • 2021-01-25 12:36

    Just give a look at the official documentation: URL Dispatcher

    Or look at this: Capturing the URL parameters in request.GET

    0 讨论(0)
  • 2021-01-25 12:57

    Use request.GET.get():

    fallback_page_num = '1'
    page = request.GET.get('page', fallback_page_num)
    
    0 讨论(0)
提交回复
热议问题