【问题标题】:How 'set_password' method works?'set_password' 方法是如何工作的?
【发布时间】:2021-05-24 17:40:34
【问题描述】:

我一直在 DRF 和 Django 文档中寻找这个,但我找不到它。

有人能解释一下基本方法是如何工作的吗?

谢谢!

【问题讨论】:

    标签: django django-rest-framework hash


    【解决方案1】:

    我们可以直接在源代码中看到。其实这个方法只在用户hash the given raw string and store it :)

        def set_password(self, raw_password):
            self.password = make_password(raw_password)
            self._password = raw_password
    

    【讨论】:

      猜你喜欢
      • 2013-03-11
      • 2019-05-20
      • 2012-04-21
      • 2016-07-26
      • 2018-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多