Django rest framework user registration?

前端 未结 6 1499
傲寒
傲寒 2020-12-29 08:57

I am following this tutorial but facing these problems I can\'t fix:

  1. Upon registering user, I can not log in with that user to the api because the password is
6条回答
  •  死守一世寂寞
    2020-12-29 09:11

    We can write a signal in User to solve this.

    def create_hash(sender, instance=None, *args, **kwargs):
    passwd = instance.password
    instance.set_password(passwd)
    
    
    pre_save.connect(create_hash, sender=User)
    

提交回复
热议问题