On Fri, Oct 7, 2011 at 3:43 PM, Shawn Milochik <sh...@milochik.com> wrote: > Make as many files as you want, and make sure you import their classes in > models.py so they get picked up by syncdb. > Normally, to do something like this you'd replace the file (in this case > models.py) with a folder named 'models' containing a file called > __init__.py, and import all the additional files' models in __init__.py. > However, there's some "magic" in Django that doesn't consider a folder a > "Django app" unless it contains a file named models.py. > Also, I recommend you don't do any of the above, because as soon as you > start doing things like creating foreign keys and many-to-many relationships > you're going to have a horrific mess, and probably circular imports. >
I do almost precisely this in most of my larger apps; I don't have one file per class, rather I keep all closely related models in one file, and haven't hit any problems with this - if you have import issues, then you have the wrong design :) Do you know specifically what magic fails? I hadn't noticed anything. Cheers Tom -- 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.