I have a model class Product
in which I am storing generic things related to a product like name, owner, price, image and type. Here the type attribute represents the category of the product and it is used for determining the other factors associated with this product.
Now I have several classes which have attributes related to different categories of a product.
So lets say I have a class ShoesInfo
which have additional attributes related to shoes like shoe color, show type (sports shoes, running shoes, etc). This class contains a foreign key to above class.
I have to split the details page in two parts. In the first part it will fill all the generic info (the fields in the Product
class) and the type. So according to the type he has entered, I have to show the additional fields in the form.
My question is how to do this at runtime. When a user enters a value in type, the additional attribute fields should appear in the django admin form.