0
class FilterForm(forms.Form):
    currency = forms.ChoiceField(choices=Currency_choices)
    continent = forms.ChoiceField(choices=Select_continent())   
    def clean_country(self):
        continent = self.cleaned_data['continent']
        result = Select_country(continent)
        return result 
    country = forms.ChoiceField(choices=clean_country()) //error is here

大陸で選択したフィールドを取得し、その大陸のすべての国を表示しようとしているので、選択した大陸の国のリストを返す clean_country を使用してみてください。しかし、私は TypeError を持っていました: clean_country() は正確に 1 つの引数 (0 を指定) を取るので、この関数をどのように使用できますか?

4

1 に答える 1