📜  django 中的清理数据是什么 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:19.791000             🧑  作者: Mango

代码示例1
what is cleaned_data in django

Any data the user submits through a form will be passed to the server as strings. It doesn't matter which type of form field was used to create the form. 
Eventually, the browser would will everything as strings. When Django cleans the data it automatically converts data to the appropriate type.
For example IntegerField data would be converted to an integer
In Django, this cleaned and validated data is commonly known as cleaned data.
We can access cleaned data via cleaned_data dictionary:
 # name = form.cleaned_data['name']