📜  django rest 框架加密密码 - Python 代码示例

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

代码示例1
from rest_framework.serializers import ModelSerializer
from django.contrib.auth.hashers import make_password


class UserSerializer(ModelSerializer):
    class Meta:
        model = backend.models.User
        fields = ('username', 'email', 'password',)

    validate_password = make_password