I'm trying to figure out how I can use the type() module to dynamically create a Django model based on existing DB tables without having to either write it out manually or use the manage.py generator to inspect the DB. Reason is my schema changes frequently -- adding new tables, adding/deleting columns, etc. Anyone have a good solution? Something similar to this would be awesome: http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/
Asked
Active
Viewed 1,410 times
3
-
1Yes, it's possible. The answer is here: http://stackoverflow.com/questions/1179469/is-it-posible-to-generate-django-models-from-the-database – jbochi Jan 25 '10 at 23:07
1 Answers
1
You can look at inspectdb code, and instead of outputting code return classes.

Dmitry Shevchenko
- 31,814
- 10
- 56
- 62