# 1.models.py ???... ???sex = models.ChoiceField( ???????choices=[ ???????????(1, "男"), ???????????(2, "女") ???????] ?????????)# index.html ???... ???{{ 模型类对象.get_sex_display }} ???# 显示男女,而非1,2;
字段中设置choices在html中显示 | Django
原文地址:http://www.cnblogs.com/pymkl/p/7909442.html