On 16-8-2012 11:33, Mike Dewhirst wrote: > https://github.com/mdewhirst/split-models > > Python 2.7 and Django 1.4 > > One of mine was getting too big and too labour-intensive to debug after > a manual split. This was due to accretion of cruft during my learning > (which hasn't stopped). So I thought I'd write a script to handle it and > my other apps as well.
Thanks for doing this! Here's a little code review: Encoding: - Starting django 1.5 python 3 compatibility is hitting django. If the models.py has a __future__ line you may want to copy it verbatim, especially the unicode_literals. You can only have one __future__ import line so it's important to test for it and copy it. - Perhaps do the same with editor modelines, like the one you have for emacs. Vi(m)'s start with either vim: vi: or ex:. - Same with db_table in the Meta class. if it's not set, don't create one: it introduces a POLA violation, cause one expects upon renaming the model to have a new database table. - If you rewrite this as a django management command, you will have all the option and argument parsing at your finger tips and can get rid of some of the hard-coded variables and don't need the project variable anymore. - I'm kind of missing the ability to "tell which models go in to which file". If you don't intend to work on this anymore, then by all means, disregard. I was contemplating to make this, but it's on a low priority so for the time being this will do the trick. -- Melvyn Sopacua -- 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.