Monday, June 4, 2012

Re: list of year form

On Tue, 2012-06-05 at 10:04 +0700, subtitle indo wrote:
> I want to create list of year select form.
> I know that i can generate the value using html.
> Is there a way to generate the value using forms API.
>
> For example, i want to generate select field that display year from
> 1970-2011.

I do not know if this is pythonic

def currentyear():
return datetime.today().year

BIRTH_YEARS = [(x,y) for x,y in enumerate(range(1970,currentyear()+1))]
--
regards
Kenneth Gonsalves

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate