本文整理汇总了Python中models.Account.name方法的典型用法代码示例。如果您正苦于以下问题:Python Account.name方法的具体用法?Python Account.name怎么用?Python Account.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Account
的用法示例。
在下文中一共展示了Account.name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import name [as 别名]
def create(request):
if request.method == 'POST':
# save new account
name = request.POST['name']
username = request.POST['username']
password = request.POST['password']
email = request.POST['email']
account = Account()
account.name = name
account.username = username
account.password = password
account.email = email
account.perfil = 'N'
account.save()
return HttpResponseRedirect(reverse('account-login'))
return render_to_response('account/account_create.html',{'request':request},
context_instance=RequestContext(request))
示例2: Account
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import name [as 别名]
import uuid
from models import engine, Account, Tweet
account = Account(
id=uuid.uuid4(), name='@garybernhardt',
email='REDACTED')
# This save will raise if the account id is already taken
unique_id = Account.id.is_(None)
engine.save(account, condition=unique_id)
account.name = 'garybernhardt'
del account.email
engine.save(account)
tweet = Tweet(
account=account.id, id='616102582239399936',
content='today, I wrote a type validator in Python, as you do',
favorites=9)
engine.save([account, tweet])
# Don't delete the tweet if it's been
# favorited enough for people to notice
not_popular = Tweet.favorites < 10
engine.delete(tweet, condition=not_popular)
same_account = Tweet.account == tweet.account
same_id = Tweet.id == tweet.id
same_content = Tweet.content == tweet.content