On Aug 9, 7:34 pm, Léon Dignòn <[email protected]> wrote:
> Hello,
>
> some times I'd like not to import a class but just write it down.
>
> Instead of
> from myproject.myapp.models import MyModel
>
> I'd like to use
> myproject.myapp.models.MyModel
>
> But I get a NameError: name 'myproject' is not defined
>
> Also
> myapp.models.MyModel
> raises a NameError: name 'myapp' is not defined
>
> Any ideas?

What are you trying to do - what do you mean by 'write it down'?

If you just want to use 'myproject.myapp.models.MyModel', instead of
just 'MyModel', when referencing a model class, that's fine - but you
still need to import myproject.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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