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


Python User.name方法代码示例

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


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

示例1: addUser

# 需要导入模块: from users.models import User [as 别名]
# 或者: from users.models.User import name [as 别名]
def addUser(request):
	password = hashlib.sha256(request.POST['password']).hexdigest()
	user = User(account=request.POST['account'],password=password)
	user.name = request.POST['name']
	user.phone = request.POST['phone']
	user.address = request.POST['address']
	if 'avatar' in request.FILES:
		user.avatar = request.FILES['avatar']
	user.save()
	return HttpResponse(200)
开发者ID:mickeyinfoshan,项目名称:Book-Drift,代码行数:12,代码来源:views.py

示例2: user

# 需要导入模块: from users.models import User [as 别名]
# 或者: from users.models.User import name [as 别名]
 def user(self):
     user = User()
     user.name = 'Johnathan Percival'
     user.lastname = 'Hackworth'
     user.login = 'theAlchemist'
     user.password = crypt("abcde", settings.PASSWORD_SALT)
     user.email = '[email protected]'
     user.location = 'Shangai'
     user.country = 1
     user.gender = 1
     user.aboutme = 'Nanotechnology and neovictorianism'
     return user
开发者ID:johnHackworth,项目名称:listify_api,代码行数:14,代码来源:mocks.py

示例3: users

# 需要导入模块: from users.models import User [as 别名]
# 或者: from users.models.User import name [as 别名]
    def users(self):
        user = User()
        user.name = 'Erasmas'
        user.login = 'erasmas'
        user.password = crypt("abcde", settings.PASSWORD_SALT)
        user.email = '[email protected]'
        user.save()
        user2 = User()
        user2.name = 'Orolo'
        user2.login = 'orolo'
        user2.password = crypt("abcde", settings.PASSWORD_SALT)
        user2.email = '[email protected]'

        user2.save()
        user3 = User()
        user3.name = 'Raz'
        user3.login = 'raz'
        user3.password = crypt("abcde", settings.PASSWORD_SALT)
        user3.email = '[email protected]'

        user3.save()
        return [user, user2, user3]
开发者ID:johnHackworth,项目名称:listify_api,代码行数:24,代码来源:mocks.py

示例4: callback

# 需要导入模块: from users.models import User [as 别名]
# 或者: from users.models.User import name [as 别名]
def callback():
    """ Step 3: Retrieving an access token.

    The user has been redirected back from the provider to your registered
    callback URL. With this redirection comes an authorization code included
    in the redirect URL. We will use that to obtain an access token.
    """

    if not 'code' in request.args:
        flash('You did not authorize the request', category='alert')
        return redirect(url_for('frontend.login'))

    # make a request for the access token credentials using code
    redirect_uri = url_for('frontend.callback', _external=True)

    data = dict(code=request.args['code'],
                redirect_uri=redirect_uri,
                scope='user:email,public_repo')

    auth = github.get_auth_session(data=data)

    # the "me" response
    githuber = auth.get('user').json()
    user = None
    try:
        user = User.objects.get(github_id=githuber['id'])
    except User.DoesNotExist:
        user = None

    if user:
        login_user(user)
        flash('Logged in as ' + githuber['name'], category='success')
        return redirect(url_for('frontend.index'))
    else:
        user = User()
        if githuber['email']:
            user.email = githuber['email']

        user.github_id = githuber['id']
        user.name = githuber['name']
        user.github_username = githuber['login']
        user.oauth_token = auth.access_token
        if githuber['location']:
            user.location = githuber['location']
        user.save()

        if login_user(user):
            flash(_("Logged in as %s, now get a shiny profile :)" % user.name),
                  category='success')

        return redirect(url_for('users.edit'))
开发者ID:mohamed-io,项目名称:dzlibs,代码行数:53,代码来源:views.py


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