推荐学习书目
› 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
lcqtdwj
V2EX  ›  Python

django-rest-framework 的 serializer 怎么像 form 一样返回表单页面?

  •  
  •   lcqtdwj ·
    jiffies · Nov 26, 2014 · 4367 views
    This topic created in 4323 days ago, the information mentioned may be changed or developed.
    LZ想要写一个django后台为浏览器渲染网页,为手机客户端返回json。原来用django.form直接在模版里渲染表单,现在为了API加入了django-rest-framework,写了一个serializer,发现跟form差不多,验证输入的validate代码都一样。怎样才能只写一serializer达到目的呢?HTMLFormrenderer不知道怎么和模版一起渲染。
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   789 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:33 · PVG 05:33 · LAX 14:33 · JFK 17:33
    ♥ Do have faith in what you're doing.