本文整理汇总了Python中user.User.age方法的典型用法代码示例。如果您正苦于以下问题:Python User.age方法的具体用法?Python User.age怎么用?Python User.age使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.age方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import age [as 别名]
def get(self):
user = User()
user.email = "[email protected]"
user.picture = "http://upload.wikimedia.org/wikipedia/commons/7/7f/Emma_Watson_2013.jpg"
user.first = "Alice"
user.age = 19
user.tagline = "I am awesome"
user.tags = ["Python"]
user.interests = ["tennis", "table tennis"]
template_values = {"user":user}
self.render("profile.html", **template_values)
示例2: post
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import age [as 别名]
def post(self):
user = User()
user.picture = "http://upload.wikimedia.org/wikipedia/commons/7/7f/Emma_Watson_2013.jpg"
user.email = self.request.get('email')
user.age = int(self.request.get('age'))
user.tagline = self.request.get('mission')
user.tags = self.request.get('tags').split(",")
user.intersts = self.request.get('interests')
user.put()
template_values = {"user":user}
self.render("profile.html", **template_values)
示例3: register_user
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import age [as 别名]
def register_user(self, name, last_name, city, age, email, login, password, secret_word):
# if email in self.emails:
# print('This email is already used')
# return
if login in self.users:
print('This login is already taken')
return
# self.emails.add(email)
new_user = User()
new_user.name = name
new_user.last_name = last_name
new_user.city = city
new_user.age = age
new_user.email = email
new_user.login = login
new_user.password = password
new_user.secret_word = secret_word
self.users[login] = new_user
print('registration successful')
示例4: sign_up_clicked
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import age [as 别名]
def sign_up_clicked(self):
self.line_edits = []
self.line_edits.append(self.lineEditPassword)
self.line_edits.append(self.lineEditName)
self.line_edits.append(self.lineEditLastName)
self.line_edits.append(self.lineEditAge)
self.line_edits.append(self.lineEditWeight)
self.line_edits.append(self.lineEditUsername)
self.line_edits.append(self.lineEditPassword)
self.label_validation.setText("")
for line_edit in self.line_edits:
if line_edit.text() == "":
self.label_validationSign.setText("All fields required.")
return
new_user = User()
new_user.first_name = str(self.lineEditName.text())
new_user.last_name = str(self.lineEditLastName.text())
new_user.age = int(self.lineEditAge.text())
new_user.weight = int(self.lineEditWeight.text())
new_user.user_name = str(self.lineEditUsername.text())
new_user.password = str(self.lineEditPassword.text())
error = database.insert_user(new_user)
if error:
if isinstance(error, MySQLdb.IntegrityError):
if "Duplicate entry" in error.args[1]:
#If we have a duplicate entry
self.label_validation.setText("Sorry that username is already taken.")
else:
#If we successfully signed up we should set a message on log in page
self.stackedWidget.setCurrentIndex(0)
self.label_validationSign.setText("Sign up SUCCESSFUL!")