我正在寻找有关为运输表创建 Django 模型结构的建议,您能帮忙吗?我想要一种简单的..这是我想要存储的东西:
| Fedex | UPS | USPS
------------------------------------------------------------------
GROUND | Home Delivery | Ground | Parcel Select
3DAY | Express Saver | 3 Day Select | Priority or First Class
2DAY | 2Day | 2nd Day Air | Priority or First Class
etc | .. | .. | ..
我想用这些创建一个模型,但我觉得我只是在制造一团糟,我的想法完全偏离了。这是我的想法,我对此并不满意:
class ShippingMethod(models.Mod
title = models.CharField(
max_length = 20,
choices = SHIPPING_TITLES, # Just a list of Fedex/UPS etc
default = "fedex"
)
service = models.CharField(
max_length = 20,
choices = SHIPPING_SERVICES, # Just a list of Ground, 2day, etc
default = "GROUND"
# This model is lacking the "Description", eg: "Parcel Select, 2nd Day Air".
我不想做三个模型
ShippingMethod -- UPS, USPS, Fedex
ShippingType -- Ground, 2Day
ShippingDescription -- "Parcel Select, 2nd Day Air"
我觉得我刚刚开始过于复杂的事情..任何建议将不胜感激:)