开发者

django SelectDateWidget Years in reverse

开发者 https://www.devze.com 2023-02-07 03:34 出处:网络
Is there a way in which you can get the \"SelectD开发者_如何学编程ateWidget\" to display the years in reverse or DESC order?

Is there a way in which you can get the "SelectD开发者_如何学编程ateWidget" to display the years in reverse or DESC order?

my_form_field = forms.DateField(widget=MonthYearWidget(years=range(2012,1970)))

Does not seem to work.

MonthYear widget is a smaller breakdown that only gives you the month and year


Try years=range(2012,1970,-1) (note the -1 as the step/increment).

0

精彩评论

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