答复: 答复: Django ORM问 题

"Handle.Huang" <[email protected]> Mon, 21 Jan 2008 00:02:37 +0800
Newsgroups gmane.comp.python.chinese
Message-ID <[email protected]>
好的,谢谢

 

发件人: [email protected]
[mailto:[email protected]] 代表 vcc
发送时间: 2008年1月20日 23:15
收件人: [email protected]
主题: Re: [python-chinese] 答复: Django ORM问题

 

你用多少个文件定义模型都可以,但是你一定要在你的app目录下有一个models.py,因
为django只会load这个文件,然后在models.py里import其他文件里的模型,例如:

import models_1

import models_2

...

这样就可以工作了。

 

----- Original Message ----- 

From: Handle.Huang <mailto:[email protected]>  

To: [email protected] 

Sent: Sunday, January 20, 2008 10:46 PM

Subject: [python-chinese] 答复: Django ORM问题

 

如果使用默认的模型的话,那一个app就只有一个model.py,如果这个app有很多表的
话,难道所有的表都要定义在这个一个文件中,要是再加上自定义方法,这个文件将会
是很恐怖的,而且结构上也不好啊。

 

PS:

         这个app已经在setting.py中已经定义了

_______________________________________________
python-chinese
Post: send [email protected]
Subscribe: send subscribe to [email protected]
Unsubscribe: send unsubscribe to  [email protected]
Detail Info: http://python.cn/mailman/listinfo/python-chinese