Django like query for Flask-SQLAlchemy
Project description
Flask-DjangoQuery
=================
A module that implements a more Django like interface for Flask-SQLAlchemy query objects. It's still API compatible with the regular one but extends it with Djangoisms.
## Usage
```python
from flask import Flask
from flask.ext.djangoquery import SQLAlchemy
app = Flask(__name__)
db = SQLAlchemy()
db.init_app(app)
```
Then you can use it just like Flask-SQLAlchemy.
### Define a model
```python
class Post(db.Model):
id = db.Column(db.Integer, primary_key=True)
pub_date = db.Column(db.Datetime)
title = db.Column(db.String(50))
## Example queries
```python
Post.query.filter_by(pub_date__year=2008)
Post.query.exclude_by(id=42)
Post.query.filter_by(title__contains='something')
Post.query.order_by('-post__pub_date')
```
=================
A module that implements a more Django like interface for Flask-SQLAlchemy query objects. It's still API compatible with the regular one but extends it with Djangoisms.
## Usage
```python
from flask import Flask
from flask.ext.djangoquery import SQLAlchemy
app = Flask(__name__)
db = SQLAlchemy()
db.init_app(app)
```
Then you can use it just like Flask-SQLAlchemy.
### Define a model
```python
class Post(db.Model):
id = db.Column(db.Integer, primary_key=True)
pub_date = db.Column(db.Datetime)
title = db.Column(db.String(50))
## Example queries
```python
Post.query.filter_by(pub_date__year=2008)
Post.query.exclude_by(id=42)
Post.query.filter_by(title__contains='something')
Post.query.order_by('-post__pub_date')
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Flask-DjangoQuery-0.1.1.zip
(6.5 kB
view details)
File details
Details for the file Flask-DjangoQuery-0.1.1.zip
.
File metadata
- Download URL: Flask-DjangoQuery-0.1.1.zip
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3c4437f8d8466ec74c2018980d3f747df79fa807412a9bd960d13f41da44140 |
|
MD5 | 92db7ab15e6931b751b33f65d4db4d11 |
|
BLAKE2b-256 | 1c96616f929236524d05f74b38b3b545873c21afcf3cf2d1ce0549f89471f480 |
File details
Details for the file Flask-DjangoQuery-0.1.1.tar.gz
.
File metadata
- Download URL: Flask-DjangoQuery-0.1.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3b06d86f9644e654e9073f86aa45abce3672a47d85784309a44dc8effaab7c6 |
|
MD5 | 982c5eb9fcb11030649b88f2decf6570 |
|
BLAKE2b-256 | a984c88fd3ce6f00cd005c647c4d9b20832339ce860f438728767f3f68d19556 |