django 插入数据库数据
code
from .models import UserProfile from django.contrib.auth.hashers import make_password user_profile = UserProfile() user_profile.username = username user_profile.email = email user_profile.password = make_password(password) #make_password是django自带的给password重新编码技术,存储在数据库中 user_profile.is_active = True #判断用户是否激活 user_profile.save()