Hacker Newsnew | comments | show | ask | jobs | submitlogin

IIRC, the way it works is that Django specifies where in the package namespace it expects things. But you can always load anything into that package namespace. If you have a file specifying models, you can either:

     class SomeModel(...): ...
     class SomeOtherModel(...): ...
or

     from some.other.place import SomeModel
     from yet.another.place import SomeOtherModel
and it's the same. Django is Python.

In fact this is another instance of what I complained about yesterday: http://news.ycombinator.com/item?id=1605928 People see the "DSL" and all knowledge of the underlying language goes flying out the window. Models are actually very, very non-magical, and anything that you do that ends up with class in the certain namespace simply is a model, and any Python language feature that lets you produces such a class can be used to make one.




This would be the same thing as Rails... yeah, it'll load everything in app/models by itself, but anything else is just a require away.

-----




Applications are open for YC Summer 2015

Guidelines | FAQ | Support | Lists | Bookmarklet | DMCA | Y Combinator | Apply | Contact

Search: