Django - choice set, but no drop down in form
<p>I would like to have a choice set in my model for template and validation.</p>

<p>However, in the model.form for that model I want to have just an integer field.</p>

<p>How can I change the widget in order to just get a InputField?</p>

<p>I tried to change the widget to forms.Model, but that did not seem to work. I get a error:</p>

<pre><code>'IntegerField' object has no attribute 'attrs'
</code></pre>

<p>forms.py:</p>

<pre><code>class KombiPublikationForm(forms.ModelForm):

    class Meta:
        model = KombiPublikation
        #fields = []
        exclude = ['pub_sprache']
        widgets = {
            'monat': forms.IntegerField(), # does not work
        }
</code></pre>

<p>model.py:</p>

<pre><code>MONTH = (
    (1, 'Januar'),
    (2, 'Februar'),
    (3, 'MÃ¤rz'),
    (4, 'April'),
    (5, 'Mai'),
    (6, 'Juni'),
    (7, 'Juli'),
    (8, 'August'),
    (9, 'September'),
    (10, 'Oktober'),
    (11, 'November'),
    (12, 'Dezember'),
)

class KombiPublikation(models.Model):
    [...]
    monat = models.IntegerField(choices=MONTH)
</code></pre>

<p>Thanks!</p>

<p>I found the solution - NumberInput() is the right widget.</p>

python django django-forms django-crispy-forms