本文整理汇总了Python中models.Profile.first_name方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.first_name方法的具体用法?Python Profile.first_name怎么用?Python Profile.first_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Profile
的用法示例。
在下文中一共展示了Profile.first_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gigya_login_return
# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import first_name [as 别名]
def gigya_login_return(request):
"""
Process login responses. There should be some settings for this
to either do a quick account creation, prompt users for more information
etc...
For now,it simply creates a new user account with bare bones info, and then the user can populate their
profile info from the various auth services after the fact.
"""
uid = request.GET.get('UID','-1')
#1. Create a new Gigya user profile object
profile = Profile()
profile.uid = uid
profile.first_name = request.GET.get('firstName','')
profile.login_provider = request.GET.get('login_provider','')
profile.city = request.GET.get('city','')
profile.state = request.GET.get('state','')
profile.zip = request.GET.get('zip','')
profile.country = request.GET.get('country','')
profile.save()
auth_user=False
userInfo = { 'nickname':request.GET.get('nickname','0'),'first_name':request.GET.get('first_name','0') }
#2. Authenticate and create a new user based on profile.uid
try:
if not request.user or not request.user.is_authenticated():
auth_user = authenticate(access_token=uid,infodict=userInfo) #the uid from gigya is our unique key.
#logging.debug("auth and create new user gigya uid:"+uid)
print "Auth and create new user gigya id:"+uid
#we need to add a little security here, but for now
#this should work. i.e: signing is required at this stage.
else:
import backends.gigyaoauth
backends.gigyaoauth.updateProfile(uid, request.user,userInfo)
if request.session.has_key('redirect_url'):
return HttpResponseRedirect("request.session['redirect_url']")
return HttpResponseRedirect("/")
except Exception,e:
print "Generic Gigya Return Error:", e
raise
return HttpResponseRedirect(LOGIN_FAILURE_PAGE)