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
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
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
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
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
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?
>
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."
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
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
9 matches
Mail list logo