Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 918859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:26:45+00:00 2026-05-15T18:26:45+00:00

I am using model forms in Django to allow the user to enter in

  • 0

I am using model forms in Django to allow the user to enter in their birthdate. I want to have the user select the date from a series of dropdown lists, one each for year, month, and day. Originally I thought that the SelectDateWidget would work. However that particular widget only displays dates in the future. I of course want to only display dates in the past.

Is there an easy way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:26:46+00:00Added an answer on May 15, 2026 at 6:26 pm

    SelectDateWidget isn’t only for dates in the future. If you want dates in the past, you need to pass a different years argument into your widget, otherwise it uses the current year. So within your form, just do:

    SelectDateWidget(years=range(1985, datetime.date.today().year+10))
    

    It basically accepts a list of years, and using the range function works pretty well for that.

    You can see how the widget works here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am using django forms on my app. I have a model Client like this:
I am using django-registration app. and have following code in forms.py from django.contrib.auth.forms import
I am using webapp2, ndb model. I was trying to use django model forms
I'm using a modelform for User like so: class UserForm(forms.ModelForm): class Meta: model =
I decided to learn Django Forms. For a while now, I have been using
I have a django form that allows a user to select multiple options: CARDS
I'm using Django and have a form with two additional inline formsets. I want
I am currently using Django forms with the Google App Engine and I have
I am learning to develop windows forms application with Entity Framework using Model View
I have the following form: @model Teesa.Models.SearchModel @using (Html.BeginForm(Index, Search, FormMethod.Get, new { id

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.