Issue
a Mobile device has many features in different types.
RAM=4: int
fingerprint=yes : boolean
camera=face detection, touch focus, panorama …
how to create field for features, create an app for features and declare each feature type ? :
class IntFeature(models.Model):
title = models.CharField()
value = models.IntegerField()
class BoolFeature(models.Model):
title = models.CharField()
value = models.BooleanField()
class CharFeature(models.Model):
title = models.CharField()
value = models.CharField()
Solution
i guess all you need is just one class with an extra field which you’ll define the type that you’ll refer to it to cast the value
class Feature(models.Model):
title = models.CharField()
value = models.CharField() # it should be a string
type = models.CharField() # it could be an object, array, json, int, boolean ..
UPDATE
it seems you want to assign a bunch of attributes - values
to a given product, may be you should look at woocommerce
to get the idea or better Oscar
a django-based ecommerce solution
Answered By – cizario
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0