Hacker Newsnew | comments | show | ask | jobs | submit login

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...)

Ok 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_mode..., may be I'm wrong...

Sorry for bothering you...


Applications are open for YC Winter 2016

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact