Skip to content
Advertisement

TypeError: __init__() got an unexpected keyword argument ‘choices’

JavaScript

forms.py

JavaScript

Advertisement

Answer

This is a form. A form deals with interacting with the user. An IntegerField of forms has no choices. After all the IntegerField of models deals with how we store data in the database.

You can use a TypedChoiceField [Django-doc] for this:

JavaScript
Advertisement