My apologizes if this question was somewhere before, but I could not find anything.
So, the question is really simple: is these any django native formfield that mimics the behavior of request.POST.getlist('something')?
In my UI, user creates a list of objects that he wants to save, and these objects are represented as a list of hidden inputs with the same name:
<input type="hidden" name="cc" value="1045">
<input type="hidden" name="cc" value="1055">
<input type="hidden" name="cc" value="1046">
request.POST.getlist does exactly what I need, but I don’t want to work with the request directly, I want do to it through the form.
Thanks for the comment. Yes I found that
ModelChoiceFieldis used toManyToManyfields in models. On the form side, it is represented asMultipleChoiceField/TypedMultipleChoiceField.So I decided to subclass this field and override
validate methods.