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

  • Home
  • SEARCH
  • 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

I have this form dropdown thats populated by a JS file. One of the
I have a web form where users answer questions via dropdowns, and I wish
I have a problem repopulating a set of checkboxes after an unsuccessful form validation
I have a form with 3 dropdowns that I want to toggle the disabled
I have a custom form... I'd like to auto save the author (authenticated user)
The short question is: I have a webpage in coldfusion / asp.net with many
I'm working with a GUI in PowerShell and trying to make the form such
I have two classes, Vat and Product. Product has a property of IVat. I
I'm running Rails 2.3.5 on a hosted server, and cannot upgrade to 3. I
I so rarely ever get pulled into dojo related work that I don't know

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.