Skip to content

Commit

Permalink
Merge branch 'release/0.29.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ri-gilfanov committed Jul 19, 2021
2 parents 0088651 + 542f6e0 commit fd36071
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 8 deletions.
4 changes: 3 additions & 1 deletion aiohttp_sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
ListDeleteMixin,
ListEditMixin,
ListViewMixin,
OffsetPagination,
PrimaryKeyMixin,
SABaseView,
SAItemAddMixin,
Expand All @@ -54,7 +55,7 @@
SAPrimaryKeyMixin,
)

__version__ = '0.28.0'
__version__ = '0.29.0'

__all__ = [
'DEFAULT_KEY',
Expand All @@ -71,6 +72,7 @@
'ListEditMixin',
'ListViewMixin',

'OffsetPagination',
'PrimaryKeyMixin',

'SABaseView',
Expand Down
6 changes: 5 additions & 1 deletion aiohttp_sqlalchemy/web_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from sqlalchemy import delete, select, update
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.sql import Delete, Select, Update
from sqlalchemy_things.pagination import OffsetPaginator

from aiohttp_sqlalchemy.constants import SA_DEFAULT_KEY
from aiohttp_sqlalchemy.utils import get_session
Expand Down Expand Up @@ -37,6 +38,10 @@ def get_sa_select_stmt(self, model: Any = None) -> Select:
return select(model or self.sa_model)


class OffsetPagination(ahth.PaginationMixin):
paginator = OffsetPaginator()


class PrimaryKeyMixin(ahth.PrimaryKeyMixin, SAModelMixin, metaclass=ABCMeta):
sa_pk_attr: Any = getattr(SAModelMixin.sa_model, 'pk', None)

Expand Down Expand Up @@ -98,7 +103,6 @@ class ListEditMixin(ahth.ListMixin, SAModelEditMixin, metaclass=ABCMeta):

class ListViewMixin(
ahth.ListMixin,
ahth.PaginationMixin,
SAModelViewMixin,
metaclass=ABCMeta,
):
Expand Down
5 changes: 5 additions & 0 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ Instance mixins

List mixins
^^^^^^^^^^^
.. autoclass:: aiohttp_sqlalchemy.OffsetPagination
:inherited-members:
:members:
:show-inheritance:

.. autoclass:: aiohttp_sqlalchemy.ListAddMixin
:inherited-members:
:members:
Expand Down
11 changes: 11 additions & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
========
Releases
========
Version 0.29
------------
**Added**

* ``OffsetPagination``.

**Changed**

* ``SAListViewMixin`` class is no longer inherited from
``aiohttp_things.PaginationMixin``.

Version 0.28
------------
**Changed**
Expand Down
30 changes: 26 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aiohttp-sqlalchemy"
version = "0.28.0"
version = "0.29.0"
description = "SQLAlchemy 1.4 / 2.0 support for aiohttp."
authors = [
"Ruslan Ilyasovich Gilfanov <ri.gilfanov@yandex.ru>",
Expand Down Expand Up @@ -34,8 +34,9 @@ repository = "https://github.com/ri-gilfanov/aiohttp-sqlalchemy"
[tool.poetry.dependencies]
python = "^3.7"
aiohttp = "^3.7.4.post0"
aiohttp-things = ">=0.12.0"
aiohttp-things = ">=0.13.0"
SQLAlchemy = "^1.4.21"
sqlalchemy-things = ">=0.9.0"
aiomysql = { version = ">=0.0.21", optional = true }
aiosqlite = { version = ">=0.17.0", optional = true }
asyncpg = { version = ">=0.23.0", optional = true }
Expand Down

0 comments on commit fd36071

Please sign in to comment.