首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
推荐学习书目
›
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
V2EX
›
Python
[django]cartridge 怎么扩展 Product 这个模型呢
pythonee
·
2015-04-11 07:59:42 +08:00
· 2532 次点击
这是一个创建于 3483 天前的主题,其中的信息可能已经有所发展或是发生改变。
比如说现在想增加一个评论,评论是存在另外一个表里,在展示Product的详情页的时候,想把这个商品的评论都展示出来,我想最好的办法就是给Product增加方法,或者是扩展action?
product
扩展
cartridge
2 条回复
•
2015-04-11 18:48:41 +08:00
1
cc21
2015-04-11 09:10:56 +08:00
http://mezzanine.jupo.org/docs/utilities.html#comments
2
wph95
2015-04-11 18:48:41 +08:00
评论(comment)模型(model)加个ForeignKey 连到Product
comment = models.ForeignKey("Product")
然后 product.comment_set.all()就是所有的评论queryset
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
2631 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 26ms ·
UTC 15:22
·
PVG 23:22
·
LAX 08:22
·
JFK 11:22
Developed with
CodeLauncher
♥ Do have faith in what you're doing.