I’ve been reading up on Dynamic Models and have been trying to create one. I’m creating the model from scratch without the help of any helper functions. The docs point to a helper function called create_model which I can’t seem to find in Django 1.3. Any ideas, why? Due to this missing helper function, I’m creating the pseudo-model like this:
Person = type('Person', (models.Model,), {
'first_name': models.CharField(max_length=255),
'last_name': models.CharField(max_length=255),
'__module__' : 'modules.testmodule'
})
This initialised a psuedo-model object and I would like to pass this pseudo Model object to one of my Forms to initialize it.
How can I set the values for the Model fields when initialising it so that the Form can inititialise it’s own fields from the Model instance.
Thanks.
This did it: