The below question can also be found on Stack Overflow here
I am working on an online store for a jewellery brand using Django-Oscar. We have 6 product types (Rings, Earrings etc.), each of which has been defined as a Product Class.
All of these product classes have 2 common attribute types (Metal Type and Primary Gemstone Type) each of which take a collection of values. Depending on the values they take (eg. Diamond, Ruby etc. for Gemstone Type), they have different sub-attributes (eg. Carat, Clarity, Origin etc. for Diamond). Also, there are attributes (such as Dimensions, Weight etc.) which are common to all product classes.
To model these attributes, I am thinking of customising the Django-Oscar framework as follows:
Alter the AbstractProduct model to include two fields: metal and primary-gemstone such that every product instance has these two fields
To vary attributes depending on the selection for metal and primary-gemstone, create two models Metal and Gemstone comprising of the possible types of metals and gemstones as fields
Create a MetalAttribute model and a GemstoneAttribute model with metal, gemstone (PK from Metal and Gemstone models) and attribute-name (eg., for Diamond gemstone type, attribute names could be carat, cut etc.) fields
For the possible values of each attribute for each metal/ gemstone, we would need a model with product, metal-type, gemstone-type, metal-attribute, gemstone-attribute, other-attribute (attributes common to all product classes such as Dimensions, Weight etc. and created using the in-built AbstractProductAttribute model) and attribute-value fields.
Question
Is the above approach efficient? Is there another way to model the above attributes without customising the framework too much?
I thought of the following alternatives to avoid customising the framework but they don't seem to meet my requirements:
Change the definition of product classes to include type of product, metal and primary gemstone (eg. Rings-Gold-Sapphire) but we have 6 product types, at least 3 metal types and at least 5 primary gemstone types, implying at least 90 product classes which seems like a lot
Use the 6 product classes and the AbstractAttributeOptionGroup model to create a group of options for each metal or gemstone type (eg. Cut, Clarity, Origin for Diamond). But then, we would require these 'options' to hold values which, I think, is not possible within the framework.
Defining product classes using metal type and gemstone type (eg. different product classes for Gold, Silver, Diamond, Sapphire etc.) would not work since a given product instance would need to belong to 2 product classes, one for the metal type and the other for the gemstone type which is not currently not possible in the framework.
--
https://github.com/django-oscar/django-oscar
http://django-oscar.readthedocs.org/en/latest/
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/af938e5b-a665-4ec2-b5d6-a67d50a0e579n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "django-oscar" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-oscar/hDlotYXHFVo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-oscar...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/CABWCobZLMF_nBi75DmdwT3Kn%3DpaMYAhPgceydj1Jp9to8ppqbg%40mail.gmail.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/CAOTX_ZS_w9tjz1Ui68qNsN%2BRt8RzQR0Njz%3Dzzuv975%2BuZu0mrg%40mail.gmail.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/CAOTX_ZS_w9tjz1Ui68qNsN%2BRt8RzQR0Njz%3Dzzuv975%2BuZu0mrg%40mail.gmail.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/5baf292a-8e5a-4fc2-aec4-a7d5ff89a363n%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/de46948e-0d3c-4ba8-b794-e170e6e969ebn%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/10ffdda8-5e18-4b1f-b878-1821ef102a4bn%40googlegroups.com.