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 5938859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:44:41+00:00 2026-05-22T15:44:41+00:00

I have a dropdown form for one to select their graduation year — graduation

  • 0

I have a dropdown form for one to select their graduation year —

graduation = forms.ChoiceField(choices=[(x,str(x)) for x in graduation_range])

How would I add an additional field and make that the default selection/display? For example, something like “Select Year”.

Currently, I’m doing —

graduation_range = range(1970,2015)
graduation_range.append('Select Year')

But it seems there must be a more straight-forward way to do this.
Thank you.

  • 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-22T15:44:42+00:00Added an answer on May 22, 2026 at 3:44 pm

    Just add:

    (u'', u'Select Year')  # First element will be the `value` attribute.
    

    So:

    choices = [(u'', u'Select Year')]
    choices.extend([(unicode(year), unicode(year)) for year in range(1970, 2015)])
    graduation = forms.ChoiceField(choices=choices)
    

    BTW, I used unicode because you were using str, but in practice a year field should probably be an integer, since all years are integers.

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

Sidebar

Related Questions

In one of my current projects I have a dropdown (select) form element. I
I have a form with two text boxes, one select drop down and one
I am using Asp.net dropdownlist in one of my form ..I have two dropdown
i have two dropdown list. first drop down:1 enter code here <form:select path=custName id=custName>
I have this HTML dropdown: <form> <input type=text id=realtxt onkeyup=searchSel()> <select id=select name=basic-combo size=1>
I have a simple dropdown menu: <form class=feedmenu align=center> <select onchange=showRSS1(this.value)> <option value=>Select an
I have a dropdown which you choose one of three values <select id=FilterType name=FilterType>
I have a select dropdown menu on one DIV and want the user to
I have two dropdown boxes in one form - only one option can be
I have a form with many textfields ,selects in which one select and one

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.