I was watching this thread for a while now, and I've got a question.

What is the reason to split the models.py file? I mean, I'm currently
working on a django project, and the models are pretty "simple" (I
usually split them into apps) the biggest models file has five or six
models in the same file. Should I split it? Why?


2011/10/7 Javier Guerra Giraldez <jav...@guerrag.com>:
> On Fri, Oct 7, 2011 at 1:06 PM, bcrem <billc...@gmail.com> wrote:
>>  I don't think this format is
>> SOOOO eccentric that a python purist who comes along later to maintain
>> my code can't figure it out pretty quickly.
>
> nobody said that.  what we're saying is:
>
> 1- one-model/one-file isn't a goal by itself.  nothing wrong with
> that; but only when justified.
>
> 2- models.py can be (and often is) split, and there are (at least)
> three ways to do it:
>
>  1.1-  turn the file into a module: replace with a directory with an
> __init__.py and extra files inside. (this works with any python file,
> views.py is another common candidate)
>
>  1.2- take most non-specifically-model code out to somewhere else
> (good when there's significant processing code, or when interfacing
> when non-django code)
>
>  1.3- split in different apps.  (usually best to rethink your design,
> enhance reusability, reduce coupling, etc)
>
> --
> 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.
>
>

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