[Django]-Retrieving list items from request.POST in django/python

86👍

6👍

Try following django >1.4 and use

request.POST.dict()

0👍

If you’re in a form, a better approach is:

posted = self.fields[field_name].widget.value_from_datadict(
    self.data, self.files, self.add_prefix(field_name)
)

This will return a list if appropriate for the field, and apply cleaning, prefixing, etc. (I copied this from Django form form.cleaned_data method.)

👤Chris

Leave a comment