A
A
Andrey Shubin2017-06-21 05:32:16
Django
Andrey Shubin, 2017-06-21 05:32:16

Product prototypes in Django?

Hello! I am writing an online store, and I can’t figure out how to make a product prototype.
For example, there are mugs and sheets of paper on sale. For mugs, the characteristics are volume and color, and for paper, the format (size) and color.
I plan to do this through the Product and Option (Many-to-many) models. Actually, for what I would like to have prototypes, but for the fact that when I create a new product, for example, a mug, I would add inlines with predefined Option for this type of product in the admin panel.
There is an idea to make the ProductPrototype model to hang Option on it for the desired product types. Then, when creating a Product, select a prototype (category type), click save and continue editing, as a result of which the overridden save method assigns the necessary Option to a specific product. But how good or bad is such an idea?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Sergeev, 2017-09-01
@idegree

Read about EAV.
But it's more efficient to use JsonField if you have postgres.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question