Modify value of a Django form field during clean()

前端 未结 7 1469
陌清茗
陌清茗 2020-12-29 04:42

I am adding custom validation to my forms and custom fields in my Django app. I would like to be able to modify the value of a field when triggering an error. For example, i

相关标签:
7条回答
  • 2020-12-29 05:35

    Way to update value in clean() is update the value in form's data dictionary:

    self.data["a34_stuff"] = "html"
    

    This works for sure.

    0 讨论(0)
提交回复
热议问题