peewee Documentation
Release 2.0.2iterated the same as any other SelectQuery: >>> for tweet in user.tweets: ... print tweet.message ... hello world this is fun look at this picture of my food The tweets attribute is just another select query order_by(Tweet.created_date.desc()): ... print tweet.message ... look at this picture of my food this is fun hello world Filtering records You can filter for particular records using normal python operators. >>> is_published == True): ... print ’%s: %s (%s)’ % (tweet.user.username, tweet.message) ... Charlie: hello world Charlie: this is fun >>> for tweet in Tweet.select().where(Tweet.created_date < datetime.datetime(20110 码力 | 65 页 | 315.33 KB | 1 年前3
peewee Documentation Release 2.10.2tweet = Tweet.create(user=huey, message='Hello!') You can also use the value of the related object’s primary key: >>> tweet = Tweet.create(user=2, message='Hello again!') If you simply wish to insert back-reference just like any other SelectQuery: >>> for tweet in user.tweets: ... print tweet.message ... hello world this is fun look at this picture of my food Filtering records You can filter for particular is_published == True): ... print '%s: %s' % (tweet.user.username, tweet.message) ... Charlie: hello world Charlie: this is fun >>> for tweet in Tweet.select().where(Tweet.created_date < datetime0 码力 | 275 页 | 276.96 KB | 1 年前3
peewee Documentation
Release 2.10.2tweet = Tweet.create(user=huey, message='Hello!') You can also use the value of the related object’s primary key: >>> tweet = Tweet.create(user=2, message='Hello again!') If you simply wish to insert back-reference just like any other SelectQuery: >>> for tweet in user.tweets: ... print tweet.message ... hello world this is fun look at this picture of my food 1.8.9 Filtering records You can filter for particular Tweet.is_published == True): ... print '%s: %s' % (tweet.user.username, tweet.message) ... Charlie: hello world Charlie: this is fun >>> for tweet in Tweet.select().where(Tweet.created_date < datetime.datetime(20110 码力 | 221 页 | 844.06 KB | 1 年前3
peewee Documentation Release 3.0.0tweet = Tweet.create(user=huey, message='Hello!') You can also use the value of the related object’s primary key: >>> tweet = Tweet.create(user=2, message='Hello again!') If you simply wish to insert back-reference just like any other Select: >>> for tweet in user.tweets: ... print(tweet.message) ... hello world this is fun look at this picture of my food Filtering records You can filter for particular Tweet.is_published == True): ... print(tweet.user.username, '->', tweet.message) ... Charlie -> hello world Charlie -> this is fun >>> for tweet in Tweet.select().where(Tweet.created_date < datetime0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation
Release 3.5.0tweet = Tweet.create(user=huey, message='Hello!') You can also use the value of the related object’s primary key: >>> tweet = Tweet.create(user=2, message='Hello again!') If you simply wish to insert back-reference just like any other Select: >>> for tweet in user.tweets: ... print(tweet.message) ... hello world this is fun look at this picture of my food In addition to returning model instances, Select Tweet.is_published == True): ... print(tweet.user.username, '->', tweet.message) ... Charlie -> hello world Charlie -> this is fun >>> for tweet in Tweet.select().where(Tweet.created_date < datetime0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation Release 3.4.0tweet = Tweet.create(user=huey, message='Hello!') You can also use the value of the related object’s primary key: >>> tweet = Tweet.create(user=2, message='Hello again!') If you simply wish to insert back-reference just like any other Select: >>> for tweet in user.tweets: ... print(tweet.message) ... hello world this is fun look at this picture of my food In addition to returning model instances, Select Tweet.is_published == True): ... print(tweet.user.username, '->', tweet.message) ... Charlie -> hello world Charlie -> this is fun >>> for tweet in Tweet.select().where(Tweet.created_date < datetime0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation Release 3.1.0tweet = Tweet.create(user=huey, message='Hello!') You can also use the value of the related object’s primary key: >>> tweet = Tweet.create(user=2, message='Hello again!') If you simply wish to insert back-reference just like any other Select: >>> for tweet in user.tweets: ... print(tweet.message) ... hello world this is fun look at this picture of my food Filtering records You can filter for particular Tweet.is_published == True): ... print(tweet.user.username, '->', tweet.message) ... Charlie -> hello world Charlie -> this is fun >>> for tweet in Tweet.select().where(Tweet.created_date < datetime0 码力 | 332 页 | 370.77 KB | 1 年前3
peewee Documentation
Release 3.5.0tweet = Tweet.create(user=huey, message='Hello!') You can also use the value of the related object’s primary key: >>> tweet = Tweet.create(user=2, message='Hello again!') If you simply wish to insert back-reference just like any other Select: >>> for tweet in user.tweets: ... print(tweet.message) ... hello world this is fun look at this picture of my food In addition to returning model instances, Select (continued from previous page) ... print(tweet.user.username, '->', tweet.message) ... Charlie -> hello world Charlie -> this is fun >>> for tweet in Tweet.select().where(Tweet.created_date < datetime0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.3.0tweet = Tweet.create(user=huey, message='Hello!') You can also use the value of the related object’s primary key: >>> tweet = Tweet.create(user=2, message='Hello again!') If you simply wish to insert back-reference just like any other Select: >>> for tweet in user.tweets: ... print(tweet.message) ... hello world (continues on next page) 1.8. Querying 85 peewee Documentation, Release 3.3.0 (continued Tweet.is_published == True): ... print(tweet.user.username, '->', tweet.message) ... Charlie -> hello world Charlie -> this is fun >>> for tweet in Tweet.select().where(Tweet.created_date < datetime0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.4.0tweet = Tweet.create(user=huey, message='Hello!') You can also use the value of the related object’s primary key: >>> tweet = Tweet.create(user=2, message='Hello again!') If you simply wish to insert back-reference just like any other Select: >>> for tweet in user.tweets: ... print(tweet.message) ... hello world this is fun look at this picture of my food In addition to returning model instances, Select Tweet.is_published == True): ... print(tweet.user.username, '->', tweet.message) ... Charlie -> hello world Charlie -> this is fun >>> for tweet in Tweet.select().where(Tweet.created_date < datetime0 码力 | 284 页 | 1.03 MB | 1 年前3
共 12 条
- 1
- 2













