Re: models as a package

2010-05-03 Thread Owen Nelson
Something I've seen that isn't particularly well documented (if at all)... If you have a model that isn't in your foo.models (ie, the top models.py for the app), and have a package setup, you need to add an app_name property to your model classes. Example myproject/ foo_app/ <-- needs to be in

Re: models as a package

2010-05-02 Thread Bill Freeman
Does your __init__.py import the otehr files, or does it import the models from them? If the former, then model Foo in foo.py of the models package of app bar must be referred to as bar.models.foo.Foo, whereas in the later case, as with having everything in a models.py file, bar.models.Foo will wo

models as a package

2010-04-30 Thread akonsu
hello, i would like to replace my models.py with a package that has a hierarchical directory structure. in __init__.py i want to define my base models, and the other files would contain models that inherit the base models. in particular i am trying to define proxy models for my models and put the

Re: models as a package, admin functionality

2006-11-27 Thread Nathan R. Yergler
Uh, nevermind... I was doing: import realFile instead of: from realFile import realClass in __init__.py On Mon, 2006-11-27 at 15:37 -0500, Nathan R. Yergler wrote: > I wrote to the list a while ago about implementing models as a package > (ie, a "models" subdirectory with

models as a package, admin functionality

2006-11-27 Thread Nathan R. Yergler
I wrote to the list a while ago about implementing models as a package (ie, a "models" subdirectory with __init__.py, etc inside). As I was told then, i needed to add: class Meta: app_label='appname' to each individual model class. That worked up to getting the datab

Re: Re: Models as a Package

2006-11-10 Thread Nathan Yergler
On Thu, 2006-11-09 at 15:49 -0600, James Bennett wrote: > On 11/9/06, Nathan Yergler <[EMAIL PROTECTED]> wrote: > >class Meta: > > app_label = 'app_name' > > Yeah, that's a huge wart that comes out of the way the metasystem > works right now. Anybody got ideas for something better? >

Re: Re: Models as a Package

2006-11-09 Thread James Bennett
On 11/9/06, Nathan Yergler <[EMAIL PROTECTED]> wrote: >class Meta: > app_label = 'app_name' Yeah, that's a huge wart that comes out of the way the metasystem works right now. Anybody got ideas for something better? -- "May the forces of evil become confused on the way to your house."

Re: Models as a Package

2006-11-09 Thread Nathan Yergler
Nevermind, I figured it out... I was forgetting the annoying class MyModel(models.Model): ... class Meta: app_label = 'app_name' Sigh... On Thu, 2006-11-09 at 15:57 -0500, Nathan Yergler wrote: > Any reason that making models.py into a package seems to make the models > invisible

Models as a Package

2006-11-09 Thread Nathan Yergler
Any reason that making models.py into a package seems to make the models invisible to syncdb? For example, with a project foo, I have a directory "models" that contains "bar.py" and "__init__.py" __init__ contains "from bar import *", but syncdb doesn't seem to see the models. Thoughts? Nathan