In my projects i often split models into several files inside a models
folder:

some_app /
    models /
        __init__.py
        some_models.py
        other_models.py
        ...

I know i must set app_label in Meta options, but even so
Model._meta.installed returns false. In
django.db.models.options.Options i've changed:
    self.installed = re.sub('\.models$', '', cls.__module__) in
settings.INSTALLED_APPS

to this:
    self.installed = re.sub('\.models.*', '', cls.__module__) in
settings.INSTALLED_APPS
capturing all from 'models'.

Is this ok or it will break anything? At least for me is working.

Another thing is that we must set the app_label, i've made another
change, in django.db.models.base.ModelBase we have:
    kwargs = {"app_label": model_module.__name__.split('.')[-2]}

In the above models layout the app_label would be "models", now is set
to "some_app" with this change:
    parts = model_module.__name__.split('.')
    kwargs = {"app_label": parts[parts.index('models')-1]}

regards,
David Elias
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to