Hi Tim,

Here is my structure

app
|-- __init__.py
|-- models.py (all  my models)
|-- auth.py  (python functions referencing models defined in models.py)
|-- blogs.py (python functions referencing models defined in models.py)
|-- views.py (python functions referencing models defined in models.py)


for auth.py and blogs.py referencing is giving import error.

Again in these files. If I do import like

from app.models import User then I get import error.

For views.py I am able to easily import @above.

--RJ






On Fri, Jun 11, 2010 at 7:18 AM, Tom Evans <[email protected]> wrote:
> I'll give you the benefit of the doubt since it seems some of this is
> getting lost in translation.
>
> Your app must have this sort of structure:
>
> app
> |-- __init__.py
> |-- models
> |   |-- __init__.py
> |   |-- auth.py
> |   `-- blogs.py
> `-- views.py
>
>
> If app/models/auth.py defines a User class, and app/models/blogs.py
> defines a Blog class, then in app/views.py you would refer to them
> like this:
>
> from app.models.auth import User
> from app.models.blog import Blog
>
> You cannot refer to them like so:
>
> from app.models import *
>
> unless you first import them into app/models/__init__.py.
>
> This is well documented python semantics; read the python docs for
> more information.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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

Reply via email to