I have an application that needs to generate its models on runtime.
This will be done according to the current database scheme.
How can it be done?
How can I create classes on runtime in python?
Should I create a json representation and save it in a database and then unserialize it into a python object?
I have an application that needs to generate its models on runtime. This will
Share
You can try to read this http://code.djangoproject.com/wiki/DynamicModels
Here is example how to create python model class:
You can also read about python meta classes:
– What is a metaclass in Python?
– http://www.ibm.com/developerworks/linux/library/l-pymeta.html
– http://gnosis.cx/publish/programming/metaclass_1.html