开发者

Use a plain list instead of a list of tuples when specifying "choices" for a Django model or form field?

开发者 https://www.devze.com 2023-03-08 15:05 出处:网络
Can you use a plain list instead of a list of tuples when specifying \"choices\" for a Django model or form field?

Can you use a plain list instead of a list of tuples when specifying "choices" for a Django model or form field?

So instead of specifying a tuple choices list like (("", ""),)

开发者_如何学编程Could you specify a single item list where the display and stored value are identical?


No.

..., choices=tuple((x, x) for x in L), ...
0

精彩评论

暂无评论...
验证码 换一张
取 消