Django forms error 'received multiple values ​​for keyword arguments' ''

Getting a weird error while defining django forms. I get an error message:

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

This happens with both TestForm and SpeciesForm (shown below); basically both forms with the keyword argument "choice". init () is never explicitly called, and forms have not yet been created in the view. There is one ModelForm and one simple 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 greatly appreciated. Not sure why this is happening, since the shapes are pretty bare bones.

+3
source share
1 answer

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)

using:

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)

, . , Specimen.SPECIES Test.TESTS. :

ChoiceField.choices

(, ) 2- . . . .

+7