Creating a dynamic Django model based on an existing database table

I am trying to figure out how I can use the type () module to dynamically create a Django model based on existing database tables without having to write it manually or using the manage.py generator to validate the database. The reason is that schemes often change me - adding new tables, adding / removing columns, etc. Anyone have a good solution? Something similar to this would be surprising: http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/

+3
source share
1 answer

You can look at the inspectdb code and instead of listing the code return classes.

+1
source

Source: https://habr.com/ru/post/1729984/


All Articles