I have a form containing a ModelMultipleChoiceField.
Is it possible to come up with a url mapping that will capture a varying number of parameters from said ModelMultipleChoiceField?
I find myself doing a reverse() call in the view passing the arguments of the form submission and realized that I don’t know how to represent, in the urlconf, the multiple values from the SELECT tag rendered for the ModelMultipleChoiceField…
This might not answer 100% of your question but, the technique I use for multivalued parameters in URLs is to pass them as an opaque blob to the view and let that do the decoding.
The call to
sorted()ensures that equivalent lists of ids produce identical URLs (assuming order ofidsisn’t significant). You can also makeidsasetif you don’t want duplicate values.