Skip to content

Commit

Permalink
order rows in descending order of id
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend committed Oct 31, 2019
1 parent c499551 commit edde4b6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions piccolo_api/crud/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class PiccoloCRUD(Router):
Wraps a Piccolo table with CRUD methods for use in a REST API.
"""

table: Table = None

def __init__(self, table: Table, read_only: bool = True) -> None:
"""
:params read_only: If True, only the GET method is allowed.
Expand Down Expand Up @@ -133,7 +131,7 @@ async def _get_all(self, params: t.Optional[t.Dict] = None):
"""
Get all rows - query parameters are used for filtering.
"""
query = self.table.select()
query = self.table.select().order_by(self.table.id, ascending=False)
if params:
model_dict = self.pydantic_model(**params).dict()
for field_name in params.keys():
Expand Down

0 comments on commit edde4b6

Please sign in to comment.