简体   繁体   English

是否可以在Django中添加多个实例?

[英]Is it possible to add multiple instances in Django?

In the image, I have the standard class with product, price, vendor, etc. I am wondering if it's possible to be able to add multiple products. 在图像中,我有产品,价格,供应商等的标准类。我想知道是否可以添加多个产品。 I used MSPaint to give out details of what I am talking about. 我用MSPaint给出了我所谈论的细节。 Basically the customer could make an order, but it would have the option of having 1, 5, 10, or unlimited amount of products in it. 基本上,客户可以下订单,但可以选择在其中包含1个,5个,10个或无限量的产品。 Is this possible? 这可能吗? What would be the best way to approach this? 什么是最好的方法来解决这个问题? Is there a better way to approach this than my image? 有没有比我的形象更好的方法来解决这个问题?

模型

阅读更多关于Django中的外键的信息

Order与OrderItem之间的外键关系以及User与Order之间的关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM