Thank you all! :)
On Aug 9, 9:35 pm, "J. Cliff Dyer" <j...@sdf.lonestar.org> wrote:
> On Sun, 2009-08-09 at 11:59 -0700, Léon Dignòn wrote:
> > In my myproject/urls.py I want to pass the class to a function.
> > Because my urls.py is full of imports, I do not want another import
> > line for this class I only use at one line, because it's easier to
> > read.
>
> > I wonder that I have to import myproject when I reference a model
> > class in an app which _is_ in the project I am currently using. For
> > that I have to ask this:
>
> > Do I really need 'import myproject' in myproject/urls.py when I'd like
> > to write somewhere in the urls.py 'myproject.myapp.models.MyModel'???
>
> In fact, you need to import more than myproject. You need to import
> myproject.myapp.models. Imports happen at the module level, which is to
> say, one file at a time. You don't need to import each class
> individually, but you do need to import each module.
>
> If you are worried about having too many imports in your urls.py
> configuration file, see if you can break it up somewhat by giving each
> app its own urlconf with only the urls relevant to that particular app.
>
> Cheers,
> Cliff
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---