Skip to content

Commit

Permalink
Merge branch 'release/0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed Jul 10, 2015
2 parents 8608ef6 + 554546d commit 1625e06
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/_static/theme_overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ a, a:visited {
color: #00BCD4;
}

a:hover {
color: #48B0F7;
}

a > em {
font-style: normal;
}
Expand Down
45 changes: 43 additions & 2 deletions docs/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A Minimal Application
.. note::

This example application will not go into details as to how the ORM works.
You can refer to the `Orator documentation <http://orator.readthedocs.org>`_ for more information.
You can refer to the `Orator documentation <http://orator-orm.com/docs>`_ for more information.


Setting up Flask-Orator for a single Flask application is quite simple.
Expand Down Expand Up @@ -137,7 +137,7 @@ You can now retrieve them easily from the database:
Relationships
-------------
=============

Setting up relationships between tables is a breeze.
Let's create a ``Post`` model with the ``User`` model as a parent:
Expand Down Expand Up @@ -241,3 +241,44 @@ But, if we need to retrieve a more fine-grained portion of posts we can actually
user.posts().where('title', 'like', '%admin%').get()
user.posts().first()
Pagination
==========

Flask-Orator supports pagination:

.. code-block:: python
users = User.paginate(15)
This will retrieve ``15`` users. The current page is determined by default by the ``?page`` query string
parameter of the request.

This behavior can be modified if needed, either by explicitely specifying the current page:

.. code-block:: python
users = User.paginate(15, request.args['index'])
or by changing the default ``Paginator`` current page resolver:

.. code-block:: python
from flask import request
from orator import Paginator
def current_page_resolver():
return request.args.get('index', 1)
Paginator.current_page_resolver(current_page_resolver)
What's more?
============

Like said in introduction Flask-Orator is a wrapper around `Orator <http://orator-orm.com>`_ to integrate it
more easily with Flask applications. So, basically, everything you can do with Orator
is also possible with Flask-Orator.

Referer to the `Orator documentation <http://orator-orm/docs/>`_ to see the features available.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'alabaster'
html_theme = 'default'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down

0 comments on commit 1625e06

Please sign in to comment.