def new_parent()->User:
# ????
username = random_string()[:30]
salt = random_string()[:5]
password = "malalaoshi"
user = User(username=username)
user.email = ""
user.password = make_password(password, salt)
user.save()
parent_group = Group.objects.get(name="??")
user.groups.add(parent_group)
# ??????
profile = Profile(user=user)
profile.save()
parent = Parent(user=user)
parent.save()
# ????
user.save()
profile.save()
parent.save()
ret_user = authenticate(username=username, password=password)
return ret_user
评论列表
文章目录