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


Python UserInfo.save方法代码示例

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


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

示例1: loginView

# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import save [as 别名]
def loginView(request):
    context = get_context(request)
    
    # Forget AccountAccesses to merge if user goes somewhere then back to login.
    if 'merge_access' in request.session:
        del request.session['merge_access']
    if 'merge_access_info' in request.session:
        del request.session['merge_access_info']
    
    if request.user.is_authenticated():
        try:
            access = request.user.accountaccess_set.all()[0]
        except IndexError:
            access = None
        else:
            client = access.api_client
            user_info = client.get_profile_info(raw_token=access.access_token)
            context['info'] = user_info

            user = request.user
            try:
                user_profile = UserProfile.objects.get(user=user)
            except UserProfile.DoesNotExist:
                new_user_info = UserInfo()
                new_user_info.save()
                user_profile, just_created = UserProfile.objects.get_or_create(user=user, user_info=new_user_info)

                # I'm not sure if this condition is necessary.
                if just_created:
                    standarize_user_info(user_info)
                    if 'gender' in user_info:
                        user_profile.gender = user_info['gender']
                    user.save()
                    user_profile.save()
    return render(request, 'login.html', context)
开发者ID:Mrowqa,项目名称:aplikacjawww,代码行数:37,代码来源:auth.py

示例2: register

# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import save [as 别名]
def register(request):
    if request.method == 'POST': # If the form has been submitted...
        row = UserInfo(email_id = request.POST['email'], password = request.POST['pwd'],
                           full_name = request.POST['fullname'])
        row.save()
        email = request.POST['email'];
    return HttpResponseRedirect('alternative')
开发者ID:sattti161,项目名称:mysite,代码行数:9,代码来源:views.py

示例3: test_signals

# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import save [as 别名]
 def test_signals(self):
     old_count = LogEntry.objects.count()
     userobject = UserInfo(name='testname', \
                           surname='testsurname', \
                           birthday='2010-02-17', \
                           about='test', \
                           contacts='test');
     userobject.save()
     self.assertNotEqual(old_count, LogEntry.objects.count())
开发者ID:dtarasiuk,项目名称:zdjango,代码行数:11,代码来源:tests.py

示例4: register

# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import save [as 别名]
def register():
	confirm = request.form['confirm']
	email = request.form['email']
	userID = request.form['hiddenfield']
	password = request.form['hiddenfield2']
	print userID," ",password
	
	if password == confirm:
		hashedPassword = generate_password_hash(password)
		user = UserInfo(userID= userID,email= email,password= hashedPassword)
		
		try:
			user.save()
			if login_user(user):
				return redirect(url_for('GetList'))
			else:
				error="Unable to Log you in due to inactive account"
		except Exception,e:
			print str(e)
			error="UserId taken. Please try another."
开发者ID:deshanadesai,项目名称:SnipLog,代码行数:22,代码来源:manage.py

示例5: adduser

# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import save [as 别名]
def adduser(request):
	posData = request.POST
	uid = posData.get('uid')
	username = posData.get('username')
	name = posData.get('name')
	gender = posData.get('gender')
	email = posData.get('email')
	if gender == 'null':
		gender = None
	elif int(gender) == 0:
		gender = 0
	else:
		gender = 1
	if username and name and email:
		if uid:
			UserInfo.objects.filter(uid=int(uid)).update(username=username, realName=name, gender=gender, email=email)
		else:
			userInfo = UserInfo(username=username, realName=name, gender=gender, email=email)
			userInfo.save()
	return HttpResponseRedirect('/userlist/')
开发者ID:gzalanhu,项目名称:simpleCMDB,代码行数:22,代码来源:views.py

示例6: create_user_info

# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import save [as 别名]
def create_user_info(*args, **kwargs):
    
    if kwargs['created']:
        user = kwargs['instance']
        user_info = UserInfo(user=user)
        user_info.save()
开发者ID:lig,项目名称:pythonica,代码行数:8,代码来源:signals.py

示例7: add_entry_user_info

# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import save [as 别名]
def add_entry_user_info(user,
                        date):
    new_user = UserInfo(username=user, last_agreement=date, enabled=True)
    new_user.save()
开发者ID:guillaume-philippon,项目名称:openstack-register,代码行数:6,代码来源:utils.py


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