I am new to django. I’m trying create an ecommerce application in which the user will select from a category of options [automobile, property, electronics, phones, clothes etc], and upon selecting an option (say automobile), the next select field options will be populated asking for model [Honda, Toyota, Chrysler etc], if user select say Toyota, a list of Toyota models comes up [Camry, Highlander, Corolla, etc.], upon selecting say Camry, another set of options comes up asking for year, and so on.
How do I implement (generate and/or store) this type of data using django models? I’ll be very grateful for a swift response to this.
It’s not the actual answer to your question, but when I read it, the htmx Cascading Selects example came into my mind, which could help you to build the frontend.
When it comes to the models, I would probably try one for the items and another one for the categories which should be nested somehow. I am using django-treenode (for a different purpose), perhaps this could be worth a look.
Also see: Django: how to choose from a list based on the previous selection? for one such implementation.