On 08/24/2011 08:15 AM, Praveen Krishna R wrote:
> *Even if you write
> 
> from models import Publisher, Book, Author
> 
> its gonna work, inside the books application;
> *
> On Wed, Aug 24, 2011 at 7:09 AM, Jim <jianbao....@gmail.com
> <mailto:jianbao....@gmail.com>> wrote:
> 
It will be working, but I personally don't like relative imports too much.

If you really wanted to do relative imports, then I would use (for newer
python versions  (>= 2.5)



# must be at the beginning of your python file
# the define will avoid any accidental relative imports
from __future__ import absolute_import

afterwards you can 'explicitely perform a relative import with'
from .models import Publisher, Book, Author # note the '.' before models

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to