看起來你有很多有趣的工作在你面前!我會從一些關於如何開始的提示開始。我會用3個初學者車型開始一起工作:(前兩者項)
# 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')
另外,外鍵,可以放在任何你想要的,但我會建議保持這些模型分開
謝謝爲headstart這就是我正是這樣做,但這是我卡在哪裏我創建管理項目模型列表過濾器與字段子類別的顏色和模式現在我如何創建一個像在鏈接中顯示的裝備,在設計師正在選擇的鏈接產品和一些屬性,我可以在產品管理中類似地過濾它,但在過濾之後,我如何將它們添加到服裝中? –