本文整理汇总了Python中user.models.User.name方法的典型用法代码示例。如果您正苦于以下问题:Python User.name方法的具体用法?Python User.name怎么用?Python User.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.models.User
的用法示例。
在下文中一共展示了User.name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register_3
# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import name [as 别名]
def register_3(request):
if email:
#register
try:
user = User.objects.get(email=email)
except:
ip = request.META.get('REMOTE_ADDR')
facebook = request.POST["facebook"]
iso = request.POST["iso"]
name = request.POST["name"]
user = User()
try:
country = Country.objects.get(iso=iso)
except:
country = Country.objects.get(id=1)
user.country_error = iso
user.username = email
user.name = name
user.email = email
user.facebook = facebook
user.country = country
user.ip = ip
user.date = datetime.now()
user.confirmed = 1
user.save()
else:
res = "not login"
return HttpResponse(res)
示例2: doAdd
# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import name [as 别名]
def doAdd(request):
param = request.POST
user = User()
user.name = param['name']
user.gender = param['gender']
user.ip = request.META['REMOTE_ADDR']
filename = '/a.jpg'
f = file(filename, 'w+')
f.write(request.FILES['photo'])
f.close
user.photo = filename
user.save()
return render_to_response('user/add.html')
示例3: _add_user
# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import name [as 别名]
def _add_user(request, email, password, band_id, facebook = "", name = "", country = ""):
#import ipdb; ipdb.set_trace()
key = hashlib.md5(email).hexdigest()
try:
country = Country.objects.get(id=country)
except:
country = Country.objects.get(id=1)
if not facebook:
confirmed = 0
try:
html = "Hello!"
html = html + "<br><br>To confirm your vote "
html = html + "<a href='http://rockranking.com/user/validate/" + key + "/'>click here</a>"
html = html + "<br><br>If you can not access the link, please copy this"
html = html + "<br>http://rockranking.com/user/validate/" + key + "/"
html = html + "<br>and paste in your browser"
html = html + "<br><br>Rock Ranking Team \m/"
_send_email(email,html)
email_feedback = 'sent'
except:
email_feedback = 'error to sent'
else:
confirmed = 1
email_feedback = 'facebook login'
try:
user = User()
user.username = ""
user.name = name
user.email = email
user.password = hashlib.md5(password).hexdigest()
user.email_feedback = email_feedback
user.facebook = facebook
user.country = country
user.ip = request.META.get('REMOTE_ADDR')
user.key = key
user.date = datetime.now()
user.action = "add_band_%s" % band_id
user.confirmed = confirmed
user.save()
return True
except:
return False
示例4: join
# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import name [as 别名]
def join(request):
user = User()
user.name = request.POST['name']
user.email = request.POST['email']
user.password = request.POST['password']
user.gender = request.POST['gender']
if User.objects.filter(email = user.email).exists() is not True:
user.save()
return HttpResponseRedirect('/user/joinsuccess')
# 입력폼 비교 구문과 이에따른 메시지 생성을 별도의 함수내에 구현하고, 그 수행 결과에 따른 action 만을
# 본 함수에서 구현하도록 한다.
# 응답으로 되돌려줄 리턴 값은
# email_available, user의 폼 입력 값들, 응답할 메시지
# 세 가지로 한다.
# elif len(User.objects.filter(email = user.email)) == 0:
# return render(request, 'user/joinform.html', {"email_availability": False, "user": user})
else:
return render(request, 'user/joinform.html', {"email_availability" : False, "user":user})