I have searched a lot on this forum and also went through the docs before posting my question here , I am developing a fashion aggregator website to show outfits currently I am scraping my products from different websites and I am storing it in csv file . My CSV has headers like this
(Title description pricell category subcategory color pattern ) . How do I design my django models to have functionality like this webpage https://lookastic.com/men/light-blue-vertical-striped-short-sleeve-shirt where you can see if a category is selected all the colors belonging to category are shown below and if one color is selected if that color has any patten then it gets showed below the color sidebar . How do I create relationships between tables and what tables do I need to create based on my csv to achieve this functionality?
Asked
Active
Viewed 50 times
-1

mohammad imran
- 65
- 3
- 9
1 Answers
0
Looks like you have a lot of fun work ahead of you! I'll get you started with some tips on how to begin. I would start with 3 beginner models to work with:
# This will be where you will store categories like top, footwear etc.
class Category(models.Model): # probably pick a more clever name
name = models.CharField()
# This is where you would put shirts, jackets etc.
class SubCategory(models.Model): # again probably pick a better name
name = models.CharField()
category = models.ForeignKey('Category')
# This is where the actual item would be
class Item(models.Model):
name = models.CharField()
colours = models.CharField() # if you want to make this better, choose it from a list of choices
pattern = models.CharField() # same as colour
price = models.DecimalField()
# etc
sub_category = models.ForeignKey('SubCategory')
Alternatively, the foreign keys could be placed wherever you want (ex. both in Item), but I would recommend keeping those models separate

Written
- 635
- 4
- 12
-
thank you for the headstart this is what I exactly did but this is where I am stuck i created admin for item model with list filter with fields subcategory color and pattern now how do I create a outfit like shown in link , in the link the designer is selecting products and with some attributes I am able to filter it similarly in product admin but after filtering how do I add them to the outfit? – mohammad imran Jul 08 '16 at 21:00