How can I use a SplitArrayField in a ModelForm
<p>I am trying to show a postgresql ArrayField as multiple input fields in a form that users can submit data.</p>

<p>Lets say I had a model:</p>

<pre><code>class Venue(models.Model):
    additional_links = ArrayField(models.URLField(validators=[URLValidator]), null=True)
</code></pre>

<p>That a form was using:</p>

<pre><code>class VenueForm(forms.ModelForm):
    class Meta:
        model = Venue
        exclude = ['created_date']
        widgets = {
            'additional_links': forms.Textarea(),
        }
</code></pre>

<p>How would I make the ArrayField use a SplitArrayField in the ModelForm?</p>

<p>I tried:</p>

<pre><code>class VenueForm(forms.ModelForm):
    additional_links = SplitArrayField(forms.TextInput(), size=5, remove_trailing_nulls=True)

    class Meta:
    ..
</code></pre>

<p>and the same in the Meta class widgets:</p>

<pre><code>    widgets = {
        'additional_links': forms.SplitArrayField(forms.TextInput(), size=3, remove_trailing_nulls=True)
    }
</code></pre>

<p>I also tried different form inputs/fields, but I always get the following error:</p>

<pre><code>/lib/python3.5/site-packages/django/contrib/postgres/forms/array.py", line 155, in __init__
    widget = SplitArrayWidget(widget=base_field.widget, size=size)
AttributeError: 'TextInput' object has no attribute 'widget'
</code></pre>