Monday, August 30, 2010

Re: manage.py: syncdb/sql do not pick up models from custom directory structure

If you define your models somewhere django doesn't expect, I think you
need to add the app_label in the model's Meta class.

http://docs.djangoproject.com/en/1.2/ref/models/options/#app-label

They mention the models submodule use case in the docs.

Hope that helps,
Alex

On Aug 30, 6:56 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Aug 30, 7:46 am, Dan <danielklaffenb...@gmail.com> wrote:
>
>
>
> > On 30 Aug., 08:26, Kenneth Gonsalves <law...@au-kbc.org> wrote:> import lib.models
>
> > > from lib.models import * - you may get an error here
>
> > Both commands work without giving any error messages. However they do
> > not actually import anything, since the models reside in seperate
> > files in the models subdir and need to be imported by "import
> > lib.models.ModelFileName". If you do not know what I am talking about,
> > this is what I mean:
>
> >http://www.nomadjourney.com/2009/11/splitting-up-django-models/
>
> > Any other ideas?
>
> > Regards,
> > Dan
>
> In your lib/models/__init__.py, do `from FooModels import *` for each
> model file.
> --
> DR.

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment