| | 1802 | Models inside models/ |
| | 1803 | ===================== |
| | 1804 | |
| | 1805 | As long as your models get larger you, maybe, will want to split them by taking |
| | 1806 | them out of models.py and placing every model on a separate file in models/ . |
| | 1807 | First create the directory models/ inside your application, and create a file |
| | 1808 | called __init__.py inside it importing your models, i.e.: |
| | 1809 | |
| | 1810 | from poll import Poll |
| | 1811 | from choice import Choice |
| | 1812 | |
| | 1813 | That would import the model Poll from models/poll.py and Choice from models/choice.py. |
| | 1814 | Take care that if your models depend on the others you'll need to import them accordingly, |
| | 1815 | for example, if Poll depends on a ForeignKey to Choice, on poll.py you'd write: |
| | 1816 | |
| | 1817 | from choice import Choice |
| | 1818 | |