2011/12/5 Brian Schott <bfsch...@gmail.com>

> What's the best dangothonic way to break up models.py or views.py for that
> matter.
> 1. Create a models.py or views.py at the top level that does a bunch of
> imports?  Explicitly or progrmmatically by looping over files?
> 2. Expose the hierarchy to the caller.  Ex: from my_app.models.my_model
> import MyModel
> 3. Break up the whole app into smaller apps?
>
> Still trying to figure out a good way to determine what should be a
> separate app.  If you have a relathionships like Publishers -> Books, and
> Authors -> Books should you try to break out Books, Authors, and Publishers
> as separate apps?
>

For views, I think the most djangoic (?) way is making a *app*/views/
package, and then put separate files there. You can import the views in
 *app*/views/__init__.py if you want, but it's really not necessary: I find
that e.g. "from user.views.permissions import edit" looks pretty well, and
the django admin does this as well.

For models: See https://code.djangoproject.com/ticket/4470 and
https://code.djangoproject.com/ticket/3591 .  (In other words: Currently
not possible in a pretty way).The currently best method is probably the one
with a _models directory, or defining the app_label. but this might be
fixed soon, the tickets have som recent activity :)

Best regards,
Håkon Erichsen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to