peewee Documentation Release 2.10.2
two foreign-keys to the User model and stores which users follow one another. Message: Analagous to a tweet. The Message model stores the text content of the tweet, when it was created, and who posted we didn't specify, a users messages will be accessible # as a special attribute, User.message_set class Message(BaseModel): user = ForeignKeyField(User) content = TextField() pub_date = DateTimeField() this: def create_tables(): database.connect() database.create_tables([User, Relationship, Message]) Open a python shell in the directory alongside the example app and execute the following: >>>0 码力 | 275 页 | 276.96 KB | 1 年前3peewee Documentation Release 2.10.2
two foreign-keys to the User model and stores which users follow one another. Message: Analagous to a tweet. The Message model stores the text content of the tweet, when it was created, and who posted we didn't specify, a users messages will be accessible # as a special attribute, User.message_set class Message(BaseModel): user = ForeignKeyField(User) content = TextField() pub_date = DateTimeField() accomplish this: def create_tables(): database.connect() database.create_tables([User, Relationship, Message]) Open a python shell in the directory alongside the example app and execute the following: >>>0 码力 | 221 页 | 844.06 KB | 1 年前3peewee Documentation Release 2.0.2
username = CharField() class Tweet(Model): user = ForeignKeyField(User, related_name=’tweets’) message = TextField() created_date = DateTimeField(default=datetime.datetime.now) is_published = BooleanField(default=True) username = CharField() class Tweet(Model): user = ForeignKeyField(User, related_name=’tweets’) message = TextField() created_date = DateTimeField(default=datetime.datetime.now) is_published = BooleanField(default=True) can be iterated 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 another0 码力 | 65 页 | 315.33 KB | 1 年前3peewee Documentation Release 3.0.0
two foreign-keys to the User model and stores which users follow one another. Message: Analagous to a tweet. The Message model stores the text content of the tweet, when it was created, and who posted didn't specify, a users messages will be accessible # as a special attribute, User.messages class Message(BaseModel): user = ForeignKeyField(User, backref='messages') content = TextField() pub_date this: def create_tables(): with database: database.create_tables([User, Relationship, Message]) Open a python shell in the directory alongside the example app and execute the following: >>>0 码力 | 319 页 | 361.50 KB | 1 年前3peewee Documentation Release 3.4.0
two foreign-keys to the User model and stores which users follow one another. Message: Analagous to a tweet. The Message model stores the text content of the tweet, when it was created, and who posted didn't specify, a users messages will be accessible # as a special attribute, User.messages class Message(BaseModel): user = ForeignKeyField(User, backref='messages') content = TextField() pub_date this: def create_tables(): with database: database.create_tables([User, Relationship, Message]) Open a python shell in the directory alongside the example app and execute the following: >>>0 码力 | 349 页 | 382.34 KB | 1 年前3peewee Documentation Release 3.4.0
two foreign-keys to the User model and stores which users follow one another. Message: Analagous to a tweet. The Message model stores the text content of the tweet, when it was created, and who posted didn't specify, a users messages will be accessible # as a special attribute, User.messages class Message(BaseModel): user = ForeignKeyField(User, backref='messages') content = TextField() pub_date = DateTimeField() accomplish this: def create_tables(): with database: database.create_tables([User, Relationship, Message]) Open a python shell in the directory alongside the example app and execute the following: >>>0 码力 | 284 页 | 1.03 MB | 1 年前3peewee Documentation Release 3.5.0
two foreign-keys to the User model and stores which users follow one another. Message: Analagous to a tweet. The Message model stores the text content of the tweet, when it was created, and who posted didn't specify, a users messages will be accessible # as a special attribute, User.messages class Message(BaseModel): user = ForeignKeyField(User, backref='messages') content = TextField() pub_date this: def create_tables(): with database: database.create_tables([User, Relationship, Message]) Open a python shell in the directory alongside the example app and execute the following: >>>0 码力 | 347 页 | 380.80 KB | 1 年前3peewee Documentation Release 3.1.0
two foreign-keys to the User model and stores which users follow one another. Message: Analagous to a tweet. The Message model stores the text content of the tweet, when it was created, and who posted didn't specify, a users messages will be accessible # as a special attribute, User.messages class Message(BaseModel): user = ForeignKeyField(User, backref='messages') content = TextField() pub_date this: def create_tables(): with database: database.create_tables([User, Relationship, Message]) Open a python shell in the directory alongside the example app and execute the following: >>>0 码力 | 332 页 | 370.77 KB | 1 年前3peewee Documentation Release 3.5.0
two foreign-keys to the User model and stores which users follow one another. Message: Analagous to a tweet. The Message model stores the text content of the tweet, when it was created, and who posted didn't specify, a users messages will be accessible # as a special attribute, User.messages class Message(BaseModel): user = ForeignKeyField(User, backref='messages') content = TextField() pub_date = DateTimeField() accomplish this: def create_tables(): with database: database.create_tables([User, Relationship, Message]) Open a python shell in the directory alongside the example app and execute the following: >>>0 码力 | 282 页 | 1.02 MB | 1 年前3peewee Documentation Release 3.3.0
two foreign-keys to the User model and stores which users follow one another. Message: Analagous to a tweet. The Message model stores the text content of the tweet, when it was created, and who posted didn't specify, a users messages will be accessible # as a special attribute, User.messages class Message(BaseModel): user = ForeignKeyField(User, backref='messages') content = TextField() pub_date = DateTimeField() accomplish this: def create_tables(): with database: database.create_tables([User, Relationship, Message]) Open a python shell in the directory alongside the example app and execute the following: >>>0 码力 | 280 页 | 1.02 MB | 1 年前3
共 16 条
- 1
- 2