delimiter
This is an optional argument which defaults to a comma: ,
. This value is used to split the submitted data. It allows you to chain SimpleArrayField
for multidimensional data:
1 2 3 4 5 6 7 8 9 10 11 | >>> from django.contrib.postgres.forms import SimpleArrayField >>> from django import forms >>> class GridForm(forms.Form): ... places = SimpleArrayField(SimpleArrayField(IntegerField()), delimiter = '|' ) >>> form = GridForm({ 'places' : '1,2|2,1|4,3' }) >>> form.is_valid() True >>> form.cleaned_data { 'places' : [[ 1 , 2 ], [ 2 , 1 ], [ 4 , 3 ]]} |
Note
The field does not support escaping of the delimiter, so be careful in cases where the delimiter is a valid character in the underlying field. The delimiter does not need to be only one character.
Please login to continue.