V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · 4151 views
    This topic created in 4174 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   ·   Solana   ·   811 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:30 · PVG 06:30 · LAX 15:30 · JFK 18:30
    ♥ Do have faith in what you're doing.