Django SelectDateWidget Years in Reverse Order

Is there a way you can get "SelectDateWidget" to display years in reverse or DESC?

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

It doesn't seem to work.

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

+3
source share
1 answer

Try it years=range(2012,1970,-1)(notice -1 as a step / increment).

+6
source

Source: https://habr.com/ru/post/1787735/


All Articles