List Info

Thread: newforms SelectDateWidget




newforms SelectDateWidget
user name
2007-02-27 05:19:10
Just a quick query about the SelectDateWidget:

The widget accepts an optional 'years' parameter for
displaying a
range of years, like this:

    SelectDateWidget(years = range(1900, 2006))

But is there an easy way I can make the years display in
reverse -
i.e. descending rather than ascending?

-Phil

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: newforms SelectDateWidget
country flaguser name
United States
2007-02-27 08:56:28
The range function has an optional 'step' argument.

Howzabout:

SelectDateWidget(years=range(2006,1900,-1))

> But is there an easy way I can make the years display
in reverse -
> i.e. descending rather than ascending?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: newforms SelectDateWidget
user name
2007-02-27 09:48:46
Thanks Mike - that did the trick.  I thought there would be
a simple
solution - should have RTFM more thoroughly...

On 27/02/07, Mike <djangstgmail.com> wrote:
>
> The range function has an optional 'step' argument.
>
> Howzabout:
>
> SelectDateWidget(years=range(2006,1900,-1))
>
> > But is there an easy way I can make the years
display in reverse -
> > i.e. descending rather than ascending?
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )