On 02/07/15 13:56, Vijay Khemlani wrote:
You could dynamically create a ModelForm based on the model class:
from django.forms import ModelForm
MetaClass = type('Meta', (), {'model': ProductItemText})
MetaModelForm = type('ProductModelForm', (ModelForm, ), {'Meta': MetaClass})
form = MetaModel
You could dynamically create a ModelForm based on the model class:
from django.forms import ModelForm
MetaClass = type('Meta', (), {'model': ProductItemText})
MetaModelForm = type('ProductModelForm', (ModelForm, ), {'Meta': MetaClass})
form = MetaModelForm()
The only thing you would need is th
I have a model which defines an item and many sub-models which inherit
from it to define the type of the model. Something like this:
Product(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODEL)
name = models.CharField(max_length=255)
ProductItemText(Product):
3 matches
Mail list logo