I put code in directory structure below,
appsname\
                models\
                            __init__.py
                            model1.py # have a class named Model1

__init__.py :
__all__ = ['model1']
from Model1 import model1

I have see the code in django.db.model.ModelBase.__new__ and find why
django MR don't support the multiple model files.

__new__ :
if getattr(new_class._meta, 'app_label', None) is None:
            # Figure out the app_label by looking one level up.
            # For 'django.contrib.sites.models', this would be 'sites'.
            new_class._meta.app_label =
model_module.__name__.split('.')[-2]
...
register_models(new_class._meta.app_label, new_class)

in my example, the model_module is "project.appsname.models.model1"
so the new_class._meta.app_label is "models" rather than "appsname".

so register models to 'models' not to 'appsname'.

I remember that django 0.91 support the multi models file.
can any develop fix it?


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to