2006年08月11日 星期五 16:18
是关于排序的. 该例子在django的网站上: http://www.djangoproject.com/documentation/0_91/db_api/ 两个Model定义如下. class Poll(meta.Model): question = meta.CharField(maxlength=255) pub_date = meta.DateTimeField() expire_date = meta.DateTimeField() def __repr__(self): return self.question class Choice(meta.Model): poll = meta.ForeignKey(Poll, edit_inline=meta.TABULAR, num_in_admin=10, min_num_in_admin=5) choice = meta.CharField(maxlength=255, core=True) votes = meta.IntegerField(editable=False, default=0) def __repr__(self): return self.choice 现在我要按poll的pub_date的顺序取出所有的choice,文档上说 "To order by a field in a different table, add the other table's name and a dot, like so: choices.get_list(order_by=('polls.pub_date', 'choice')) " 我按照文档所给的方式执行,提示找不到column:polls.pub_date 请高人指点.谢谢 -- devdoer devdoer at gmail.com http://project.mytianwang.cn/cgi-bin/blog -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060811/b1d35b75/attachment.html
Zeuux © 2025
京ICP备05028076号