推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
Yuanhan
V2EX  ›  Python

Django 获取当前的 URL

  •  
  •   Yuanhan · Jun 16, 2015 · 3346 views
    This topic created in 4140 days ago, the information mentioned may be changed or developed.

    由于URL后带有参数,每次都不同。
    想要动态获取URL,不知道Django如何实现。
    本人是一名初学者,相通过学习Django来了解Python,希望诸位指点。
    网址示例: http://a.b.com/?from=xx&yy=0

    jruif
        1
    jruif  
       Jun 16, 2015
    问好后面是查询字段,看文档你就懂了: https://docs.djangoproject.com/en/1.8/ref/request-response/
    Yuanhan
        2
    Yuanhan  
    OP
       Jun 16, 2015
    @jruif 十分感谢您的赐教,我读了您发的文档,觉得request.get_full_path()应该是我所需。
    恕我愚钝,产生各种报错。能否浪费你点时间,写个用法示例,小弟感激不尽
    mugbya
        3
    mugbya  
       Jun 17, 2015
    看这个吧 [How can I build multiple submit buttons django form?](http://stackoverflow.com/questions/866272/how-can-i-build-multiple-submit-buttons-django-form)

    一样原理
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   903 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 21:16 · PVG 05:16 · LAX 14:16 · JFK 17:16
    ♥ Do have faith in what you're doing.