开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜