Re: Creating model (table) inheritance in Django 1.8 using PostgreSQL

2015-07-02 Thread Some Developer
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

Re: Creating model (table) inheritance in Django 1.8 using PostgreSQL

2015-07-02 Thread Vijay Khemlani
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

Creating model (table) inheritance in Django 1.8 using PostgreSQL

2015-07-02 Thread Some Developer
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):