0
class StatisticsBaseForm(forms.Form):
type_choice = forms.ChoiceField(_("Type"), choices=settings.STATISTICS_TYPE_CHOICES, default=0)
period = forms.ChoiceField("Period", max_length=20, choices=settings.PERIODS, default='week')
def __init__(self, *args, **kwargs):
super(StatisticsBaseForm, self).__init__(*args, **kwargs)
self.helper = FormHelper(self)
class Meta:
model = Statistics
fields = '__all__'
Die Traceback ‚Entscheidungen‘ Schlüsselwort-Argument ist die folgendeTypeerror: __init __() bekam mehrere Werte für
File "/home/jeremie/Projects/Work_Projects/django/loanwolf/statistics/urls.py", line 6, in <module>
from loanwolf.statistics.views import StatisticsIndexView
File "/home/jeremie/Projects/Work_Projects/django/loanwolf/statistics/views.py", line 8, in <module>
from loanwolf.statistics.forms import StatisticsBaseForm
File "/home/jeremie/Projects/Work_Projects/django/loanwolf/statistics/forms.py", line 17, in <module>
class StatisticsBaseForm(forms.Form):
File "/home/jeremie/Projects/Work_Projects/django/loanwolf/statistics/forms.py", line 18, in StatisticsBaseForm
type_choice = forms.ChoiceField(_("Type"), choices=settings.STATISTICS_TYPE_CHOICES, default=0)
TypeError: __init__() got multiple values for keyword argument 'choices'
ich diesen Fehler, aber ich habe es nicht geschafft, es zu beheben. Wie kann ich den Fehler beheben? Am Anfang war StatisticsBaseForm
ein forms.ModelForm
, und type_choice
und period
war in meinem Statistikmodell, wo beide SmallIntegerfield
waren. In diesem spezifischen Kontext hat alles gut funktioniert.