0
我正在爲餐廳創建一個菜單系統,並且需要能夠列出具有靈活屬性的菜單項,這些屬性有時可以從模型(數據庫)以django形式進行選擇。由於項目數量和屬性沒有預先定義,所以需要靈活,表單需要能夠呈現。django:餐廳菜單的靈活形式?
示例使用情形:
1. Hawaiian Pizza
* unselectable attributes: pineapple, ham (we are assuming you can't change this)
* selectable attributes (all boolean True/False): spicy, extra cheese, extra meat, extra pineapple
* prices: large - $9.99, extra large - $14.99
這將作爲渲染:
1. Hawaiian Pizza
Pineapple and Ham
[ ] spicy [ ] extra cheese [ ] extra meat [ ] extra ham
$9.99 { button }
$14.99 { button }
這使我下訂單的
一)夏威夷披薩,有額外的奶酪,多餘的肉並且辣!爲$ 14.99
或
B)夏威夷披薩超大使其辣。大於9.99美元
在理想情況下,我甚至會爲「額外屬性」添加一個價格。
任何人都知道如何獲得靈活的屬性? ...或如何實現這一目標的建議?
這看起來像Drupal本來是理想的,它具有靈活的屬性系統。