I have a form with multiple input fields, but only want to use one input from the form. What is the proper way to check field validity and get cleaned data for the on开发者_如何学Ce field?
thanks !
The proper way would probably be to add it to it's own form ;)
But... you can do it like this:
form = SomeForm(request.POST)
field = form.fields['your_field']
data = field.widget.value_from_datadict(form.data, form.files, form.add_prefix('your_field'))
cleaned_data = field.clean(data)
精彩评论