当前位置: 首页>>代码示例>>Python>>正文


Python User.password方法代码示例

本文整理汇总了Python中account.models.User.password方法的典型用法代码示例。如果您正苦于以下问题:Python User.password方法的具体用法?Python User.password怎么用?Python User.password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在account.models.User的用法示例。


在下文中一共展示了User.password方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: register2

# 需要导入模块: from account.models import User [as 别名]
# 或者: from account.models.User import password [as 别名]
def register2(request):
    print("hhhhhhhhh====")
    if request.method == "POST":
        uf = UserForm(request.POST)
        if uf.is_valid():
            #获取表单信息
			
            username = uf.cleaned_data['username']
            password = uf.cleaned_data['password']
            phone = uf.cleaned_data['phone']
            email = uf.cleaned_data['email']
            #将表单写入数据库
            print('1111======')
            user = User()
            user.username = username
            user.password = password
            user.phone = phone
            user.email = email
            user.save()
            print('save======')
            #返回注册成功页面
            return render(request, 'success.html', {'username':username})
    else:
        uf = UserForm()
        return render(request, 'register.html', {'uf':uf})
开发者ID:xinxiang16,项目名称:website,代码行数:27,代码来源:views.py

示例2: create_users

# 需要导入模块: from account.models import User [as 别名]
# 或者: from account.models.User import password [as 别名]
def create_users():
	User.objects.exclude(pk=1).delete()
	
	for pk, fields in users.iteritems():
		if pk != 1:
			if fields['email'] != '':
				existing = User.objects.filter(email = fields['email'])
				if existing.count() > 0:
					ou = existing[0]
					if ou.is_active == False and fields['is_active'] == True:
						replace_users[ou.pk] = pk
						for k,v in replace_users.iteritems():
							if v == ou.pk:
								replace_users[k] = pk
						ou.delete()
					elif ou.is_active == True and fields['is_active'] == False:
						replace_users[pk] = ou.pk
						for k,v in replace_users.iteritems():
							if v == pk:
								replace_users[k] = ou.pk
						continue
					else:
						replace_users[ou.pk] = pk
						for k,v in replace_users.iteritems():
							if v == ou.pk:
								replace_users[k] = pk
						ou.delete()

			#print "email:", fields['email']
			nu = User(pk=pk)
			nu.username = fields['username']
			if fields['email']:
				nu.email = fields['email']
				nu.status = 1
			nu.password = fields['password']
			nu.full_name = fields['profile']['full_name']
			nu.message = fields['profile']['message']
			nu.is_active = fields['is_active']
			nu.is_staff = fields['is_staff']
			nu.is_superuser = fields['is_superuser']
			nu.comment_count = fields['profile']['comment_count']
			nu.dateo_count = fields['profile']['item_count']
			nu.vote_count = fields['profile']['vote_count']
			nu.client_domain = datea
			nu.save()

			joined = date_parser(fields['date_joined'])
			lastlog = date_parser(fields['last_login'])
			User.objects.filter(pk=nu.pk).update(date_joined=joined, created=joined, last_login=lastlog)

	for pk, fields in usersSocial.iteritems():
		if fields['user'] != 1:
			nusoc = UserSocialAuth(pk=pk)
			nusoc.provider = fields['provider']
			nusoc.uid = fields['uid']
			nusoc.user_id = get_user(int(fields['user']))
			nusoc.extra_data = fields['extra_data']
			nusoc.save()
开发者ID:lafactura,项目名称:datea-migrate-db,代码行数:60,代码来源:import_data.py

示例3: register

# 需要导入模块: from account.models import User [as 别名]
# 或者: from account.models.User import password [as 别名]
def register(request):
    if request.method == "POST":
        uf = UserForm(request.POST)
        if uf.is_valid():
            username = uf.cleaned_data['username']
            password = uf.cleaned_data['password']
            user = User()
            user.username = username
            user.password = password
            user.save()
            return render_to_response('success.html',{'username':username}, context_instance = RequestContext(request))
    else:
        uf = UserForm()
        return render_to_response('register.html', {'uf' : uf}, context_instance = RequestContext(request))
开发者ID:yfjelley,项目名称:cqt,代码行数:16,代码来源:views.py

示例4: register

# 需要导入模块: from account.models import User [as 别名]
# 或者: from account.models.User import password [as 别名]
def register(request):
    if request.method=='POST':
        uf=UserForm(request.POST)
        if uf.is_valid():
            username=uf.cleaned_data['username']
            password=uf.cleaned_data['password']
            emali=uf.cleaned_data['email']
            user=User()#User models
            user.username=username
            user.password=password
            user.email=emali
            user.save()
            return render(request,'success.html',{'username':username})
    else:
        uf=UserForm()
        return render(request,'register.html',{'uf':uf})
开发者ID:luyibo,项目名称:django,代码行数:18,代码来源:views.py

示例5: register

# 需要导入模块: from account.models import User [as 别名]
# 或者: from account.models.User import password [as 别名]
def register(request):
    if request.method == 'POST':
        uf = RegisterFrom(request.POST)
        if uf.is_valid():
            #get post information
            username = uf.cleaned_data['username']
            password = uf.cleaned_data['password']
            email = uf.cleaned_data['email']
            #write data into sql
            user = User()
            user.username = username
            user.password = password
            user.email = email
            user.save()
            #return successed page
            return render_to_response('successRegister.html', {'username': username})
    else:
        uf = RegisterFrom()
    return render_to_response('register.html', {'uf': uf}, context_instance=RequestContext(request))
开发者ID:zhouwangyiteng,项目名称:django_exercise,代码行数:21,代码来源:views.py

示例6: register

# 需要导入模块: from account.models import User [as 别名]
# 或者: from account.models.User import password [as 别名]
def register(request):
    if request.method == "POST":
        uf = UserForm(request.POST)
        if uf.is_valid():
            # 获取表单信息
            username = uf.cleaned_data['username']
            password = uf.cleaned_data['password']
            email = uf.cleaned_data['email']
            # 将表单输入数据库
            usr = User()
            usr.username = username
            usr.password = password
            usr.email = email
            usr.save()
            # 返回注册成功页面
            return render_to_response('success.html',{'username':username})
        else:
            uf = UserForm()

        return render_to_response('registe.html',{'uf':uf})
开发者ID:FightingEveryDay,项目名称:PythonDemo,代码行数:22,代码来源:views.py

示例7: register

# 需要导入模块: from account.models import User [as 别名]
# 或者: from account.models.User import password [as 别名]
def register(request):
    error=[]
    if request.method == "POST":
        uf = UserForm(request.POST)
        if uf.is_valid():
            #获取表单信息
            username = uf.cleaned_data['username']
            password = uf.cleaned_data['password']
            password2 = uf.cleaned_data['password2']
            phone = uf.cleaned_data['phone']
            email = uf.cleaned_data['email']
            #增加验证信息
            if not User.objects.all().filter(username=username):
                if uf.pwd_validate(password, password2):
                    #将表单写入数据库
                    print('1111======')
                    user = User()
                    user.username = username
                    user.password = password
                    user.phone = phone
                    user.email = email
                    user.save()
                    print('save======')
                    #返回注册成功页面
                    return render(request, 'home_base.html', {'username':username,'logined':True})
                else:
                    error.append('请输入相同的密码')
            else:
                error.append('用户名已存在')

            return render(request, 'register.html', {'uf': uf, 'error': error})
        else:
            print("error===")
            return render(request, 'register.html', {'uf': uf, 'error': error})
    else:
        uf = UserForm()
        return render(request, 'register.html', {'uf':uf, 'error':error})
开发者ID:xinxiang16,项目名称:website,代码行数:39,代码来源:views.py


注:本文中的account.models.User.password方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。