#4470: Separate models.py in multiple files
------------------------------------------------------------------+---------
Reporter: Sidi Mohamed EL AATIFI <[email protected]> |
Owner: nobody
Status: closed |
Milestone:
Component: Database layer (models, ORM) |
Version: SVN
Resolution: duplicate |
Keywords: models
Stage: Design decision needed |
Has_patch: 1
Needs_docs: 0 |
Needs_tests: 1
Needs_better_patch: 0 |
------------------------------------------------------------------+---------
Comment (by filipd):
I agree with semenov; Django does split big modules under a package--check
out how Django's own models are split under a package with a separate
field module for model fields:
{{{
+ models/
|- fields/ # Fields broken into several modules too
|- __init__.py # Models go here
|- manager.py # Manager goes here
|- ...
}}}
This can be done right now without patching Django, with the exception
that you must have the `models.py` module and the package cannot be named
`models`.
{{{
+ myapp/
+ _models/
|- __init__.py # Models go here
|- fields.py # Custom model fields
|- managers.py # Custom managers
|- model_group.py # If you have some specialized models that can be
grouped together to split the bloat from __init__.py
|- validators.py # When you have more than half a dozen
|- ...
+ models.py # Imports all the relevant bits from _models
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/4470#comment:18>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.