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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:55:20+00:00 2026-05-21T18:55:20+00:00

Getting a strange error when defining my django forms. I get the error: __init__()

  • 0

Getting a strange error when defining my django forms. I get the error:

__init__() got multiple values for keyword argument 'choices'

This happens with both TestForm and SpeciesForm (quoted below); basically both forms with the ‘choices’ keyword argument. init() is never explicitly called, and the forms aren’t even instantiated in the view yet. There’s one ModelForm and one plain Form.

from django import forms as f
from orders.models import *

class TestForm(f.Form):
    species = f.ChoiceField('Species', choices=Specimen.SPECIES)
    tests = f.MultipleChoiceField('Test', choices=Test.TESTS, widget=f.CheckboxSelectMultiple())
    dna_extraction = f.CharField('DNA extraction', help_text='If sending pre-extracted DNA, we require at least 900 ng')

class SpeciesForm(f.ModelForm):
    TYPE_CHOICES = (
        ('blood', 'Blood'),
        ('dna', 'Extracted DNA'),
    )
    dam_provided = f.BooleanField('DAM', help_text='Is dam for this specimen included in sample shipment?')
    sample_type = f.ChoiceField('Type of sample', choices=TYPE_CHOICES)
    dna_concentration = f.CharField('DNA concentration', help_text='If sending extracted DNA, approximate concentration')

    class Meta:
        exclude = ['order']
        model = Specimen

Any help would be appreciated. Not sure why this is happening as the forms are pretty bare-bones.

  • 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-21T18:55:21+00:00Added an answer on May 21, 2026 at 6:55 pm

    http://code.djangoproject.com/browser/django/trunk/django/forms/fields.py#L647

    647     def __init__(self, choices=(), required=True, widget=None, label=None,
    648                  initial=None, help_text=None, *args, **kwargs):
    649         super(ChoiceField, self).__init__(required=required, widget=widget, label=label,
    650                                         initial=initial, help_text=help_text, *args, **kwargs)
    

    use:

    species = f.ChoiceField(label='Species', choices=Specimen.SPECIES)
    tests = f.MultipleChoiceField(label='Test', choices=Test.TESTS, widget=f.CheckboxSelectMultiple())
    

    and:

    sample_type = f.ChoiceField(label='Type of sample', choices=TYPE_CHOICES)
    

    This is assuming that your choices are valid. Not sure what Specimen.SPECIES and Test.TESTS are. Those should be iterable of two-tuples according to:

    ChoiceField.choices

    An iterable (e.g., a list or tuple) of
    2-tuples to use as choices for this
    field. This argument accepts the same
    formats as the choices argument to a
    model field. See the model field
    reference documentation on choices for
    more details.

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

Sidebar

Related Questions

I'm getting an error here that says I haven't defined a method, but it
Every time that I want to do a Layout, I'm getting a black layout
We manage a site for a medical charity. They have a number of links

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.