I'm trying to develop a new app in django
I'm going to create an easy e-commerce app.
This app contains model that include all possible products in the shop.
class Product (models.Model):
name=models.CharField(max_length=20)
and another one that contains all possible form elements for products.
class Product (models.Model):
id=models.ForeignKey(products, on_delete=models.CASCADE)
amount=DecimalField(max_digits=6, decimal_places=2)
weigth=DecimalField(max_digits=6, decimal_places=2)
color=models.CharField(max_length=20)
country=models.CharField(max_length=20)
batterycapacity=amount=DecimalField(max_digits=6, decimal_places=2)
size=DecimalField(max_digits=2, decimal_places=1)
My goal is to create uniqe form collection for every product because for example shoes has different collection of chareacteristic from for example battery.
My question is. Is there any way to match chosen form elements for every product?
May be instead creating model to connect proper form elements to particular product i should use forms.py in some way.
Any suggestions?