4 ms·
Model package management: It's a dirty kludge. Not documented (last time I've checked), I had to search hard to get it right. You must edit models/__init__.py
by bhdz 16y ago
Model package management:
It's a dirty kludge. Not documented (last time I've checked), I had to search hard to get it right.
You must edit models/__init__.py such that:
import X from Y
...and then each model must have
class Meta:
app_label = 'foobar'
Without the meta information Django cannot load the models inside the package, it imports only models.py.
May be it should be automated (model loader)?
For instance, the model loader could parse the directory tree and import all necessary info it needs(meta information, optional), all is needed is a function for it :-/
edit: Format, gramer :)
edit2:
Phah! OK. I'm gonna do it. Automatic model loader function, Django extension :) (May be next week...)
- bhdz 16y agoOk HN :-/ However, for those interested in model package loading automation, I started a section on reddit: http://www.reddit.com/r/django/comments/d1ulg/automatic_models_package_loader_django_extension_d/ http://www.reddit.com/r/django/comments/d1ulg/automatic_mode..., may be I'm wrong... Sorry for bothering you...