peewee Documentation Release 3.0.0Usually this type of duplication is undesirable. To accomodate the more common (and intuitive) workflow of listing a person and attaching a list of that person’s pets, we can use a special method called database.connect() # This hook ensures that the connection is closed when we've finished # processing the request. @app.teardown_request def _db_close(exc): if not database.is_closed(): example we’ll use some different models in a many-to-many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): photo = ForeignKeyField(Photo)0 码力 | 319 页 | 361.50 KB | 1 年前3
peewee Documentation
Release 3.5.0Usually this type of duplication is undesirable. To accomodate the more common (and intuitive) workflow of listing a person and attaching a list of that person’s pets, we can use a special method called database.connect() # This hook ensures that the connection is closed when we've finished # processing the request. @app.teardown_request def _db_close(exc): if not database.is_closed(): example we’ll use some different models in a many-to-many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): photo = ForeignKeyField(Photo)0 码力 | 347 页 | 380.80 KB | 1 年前3
peewee Documentation Release 3.4.0Usually this type of duplication is undesirable. To accomodate the more common (and intuitive) workflow of listing a person and attaching a list of that person’s pets, we can use a special method called database.connect() # This hook ensures that the connection is closed when we've finished # processing the request. @app.teardown_request def _db_close(exc): if not database.is_closed(): example we’ll use some different models in a many-to-many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): photo = ForeignKeyField(Photo)0 码力 | 349 页 | 382.34 KB | 1 年前3
peewee Documentation Release 3.1.0Usually this type of duplication is undesirable. To accomodate the more common (and intuitive) workflow of listing a person and attaching a list of that person’s pets, we can use a special method called database.connect() # This hook ensures that the connection is closed when we've finished # processing the request. @app.teardown_request def _db_close(exc): if not database.is_closed(): example we’ll use some different models in a many-to-many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): photo = ForeignKeyField(Photo)0 码力 | 332 页 | 370.77 KB | 1 年前3
peewee Documentation
Release 3.5.0Usually this type of duplication is undesirable. To accomodate the more common (and intuitive) workflow of listing a person and attaching a list of that person’s pets, we can use a special method called _db_connect(): database.connect() # This hook ensures that the connection is closed when we've finished # processing the request. @app.teardown_request def _db_close(exc): if not database.is_closed(): database.close() this example we’ll use some different models in a many-to-many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): photo = ForeignKeyField(Photo)0 码力 | 282 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.3.0Usually this type of duplication is undesirable. To accomodate the more common (and intuitive) workflow of listing a person and attaching a list of that person’s pets, we can use a special method called _db_connect(): database.connect() # This hook ensures that the connection is closed when we've finished # processing the request. @app.teardown_request def _db_close(exc): if not database.is_closed(): database.close() this example we’ll use some different models in a many-to-many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): photo = ForeignKeyField(Photo)0 码力 | 280 页 | 1.02 MB | 1 年前3
peewee Documentation
Release 3.4.0Usually this type of duplication is undesirable. To accomodate the more common (and intuitive) workflow of listing a person and attaching a list of that person’s pets, we can use a special method called _db_connect(): database.connect() # This hook ensures that the connection is closed when we've finished # processing the request. @app.teardown_request def _db_close(exc): if not database.is_closed(): database.close() this example we’ll use some different models in a many-to-many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): (continues on next page)0 码力 | 284 页 | 1.03 MB | 1 年前3
peewee Documentation Release 3.6.0Usually this type of duplication is undesirable. To accommodate the more common (and intuitive) workflow of listing a person and attaching a list of that person’s pets, we can use a special method called database.connect() # This hook ensures that the connection is closed when we've finished # processing the request. @app.teardown_request def _db_close(exc): if not database.is_closed(): example we’ll use some different models in a many-to-many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): photo = ForeignKeyField(Photo)0 码力 | 377 页 | 399.12 KB | 1 年前3
peewee Documentation
Release 3.6.0Usually this type of duplication is undesirable. To accommodate the more common (and intuitive) workflow of listing a person and attaching a list of that person’s pets, we can use a special method called _db_connect(): database.connect() # This hook ensures that the connection is closed when we've finished # processing the request. @app.teardown_request def _db_close(exc): if not database.is_closed(): database.close() this example we’ll use some different models in a many-to-many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): photo = ForeignKeyField(Photo)0 码力 | 302 页 | 1.02 MB | 1 年前3
peewee Documentation Release 2.10.2database.connect() # This hook ensures that the connection is closed when we've finished # processing the request. @app.teardown_request def _db_close(exc): if not database.is_closed(): example we’ll use some different models in a many-to-many configuration: class Photo(Model): image = CharField() class Tag(Model): name = CharField() class PhotoTag(Model): photo = ForeignKeyField(Photo) perspective which model the ManyToManyField goes on, since the back-reference is just the mirror image. In order to write valid Python, though, you will need to add the ManyToManyField on the second model0 码力 | 275 页 | 276.96 KB | 1 年前3
共 16 条
- 1
- 2













