On Mon, Apr 23, 2012 at 6:47 AM, bruno desthuilliers
<bruno.desthuilli...@gmail.com> wrote:
> Models - like any other module - should indeed be "as simple as
> possible", _but not simpler_. If you concern is about your models.py
> file size, it might be time to refactor it into a package.

or maybe the app has to be more focused, and split in two or more apps.


> Now if there are parts of your methods that are low-level enough and
> don't really need to know about your models, yeps, they may belong to
> some "model-agnostic" utility module.

also when the usercase concepts are not exactly the same as the
database records. then another model-like layer can be useful.

for example, lets say you're working with a genealogy application, and
you have a Person model, and several kinds of relationships between
person instances.   But let's also say that you have a 'Family'
concept that is easy to derive from the database (so it doesn't need
another model class), but you want to add some extra behaviour at the
Family level (above Person and Relationship).   then it might be
useful to add a new Family.py module that works on your models and is
managed by the views in similar ways to them.


but in the end, yes: the vast majority of business logic belongs in
models.py files, definitely not in the views.

-- 
Javier

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