In the model's meta class, give it a field app_label, eg:

class MyModel(models.Model):
    ...

    class Meta:
        app_label = "myapp"

I use this to split my models into multiple files in a models
subdirectory of my app. Adding a __init__.py with
from modelfile import *
for each model file makes this directory into a models submodule.

On Feb 12, 2:49 am, Bill Freeman <ke1g...@gmail.com> wrote:
> One issue is that for syncdb to work it has to find all of the models.
>  It does this,
> IIUC, by importing models from each INSTALLED_APP.  If you can arrange for
> that to import your added model, you are on the right track.  For example, you
> can make your models.py files each import an extra file containing the extra
> model(s) *for that app*.  But I suspect that you are trying to do this without
> modifying the models.py files of the apps, and I don't see a simple approach,
> and complicated approaches (such as iterating through INSTALLED_APPS
> yourself and plugging an extra class into each in django's internal 
> structures)
> is likely to be hard to maintain, and be dependent on django internals that 
> can
> change from version to version.
>
> Bill
>
>
>
> On Thu, Feb 11, 2010 at 3:51 AM, Sameer Rahmani <lxsam...@gmail.com> wrote:
> > Hi ,
> > is there any way to build a new model from outside of models.py ? or in
> > other application ?
>
> > i want to build a model for a class for each application
>
> > --
> > lxsameer
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to