On Mon, April 10, 2006 09:01, James Bennett wrote:
>
> On 4/10/06, Fawad Halim <[EMAIL PROTECTED]> wrote:
>
>> I was trying to port an existing (0.91) app to the m-r branch, and
>> found that apparently, the m-r branch requires the models to reside in
>> models.py directly under the app directory
>
> The only restriction I'm aware of is that there needs to be something
> importable in Python by 'projectname.appname.models'. Whether that's a file
> called 'models.py' or a directory called 'models' is up to you; 'manage.py
> startapp' generates a single 'models.py' file, but that's not indicative
> of any restrictions on what you can do by manually creating directories
> and files.
>
> --
> "May the forces of evil become confused on the way to your house."
> -- George Carlin
My original model was in <projectname>/models/<filename>.py (there is 1
app in the project, so I made the project itself the app). I ported the
model differences in <filename>.py, and tried to import
<projectname>.models.<filename> in manage.py shell. I got the error
INSTALLED_APPS must contain <projectname>.models.<filename> in order for
you to use this model.
I had <projectname> in INSTALLED_APPS from before. Moving the model file
from <projectname>.models.<filename>.py to <projectname>.models.py made
the import work.
In db/models/base.py, there is a check that goes like
if re.sub('\.models$', '', mod) not in settings.INSTALLED_APPS:
That kinda indicates that the models module name should end in .models.
Regards
-fawad
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---