Skip to content

Commit

Permalink
Bump version 2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshYuJump committed Nov 19, 2021
1 parent 20dd98d commit c45f559
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bali/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.1.1'
__version__ = '2.1.2'
2 changes: 1 addition & 1 deletion bali/resources/model_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def create(self, schema_in: schema = None):
def update(self, schema_in: schema = None, pk=None):
item = self.model.first(id=pk)
# noinspection PyUnresolvedReferences
for k, v in schema_in.dict():
for k, v in schema_in.dict().items():
setattr(item, k, v)
return item.save()

Expand Down
1 change: 1 addition & 0 deletions examples/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from .greeter import *
from .item import *
from .item_model_resource import *
18 changes: 18 additions & 0 deletions examples/resources/item_model_resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import Optional

from pydantic import BaseModel

from bali.resources import ModelResource
from models import Item
from permissions import IsAuthenticated
from schemas import ItemModel


class QFilter(BaseModel):
name: str


class ItemModelResource(ModelResource):
model = Item
schema = ItemModel
permission_classes = [IsAuthenticated]
7 changes: 4 additions & 3 deletions examples/v1/app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from fastapi_pagination import LimitOffsetPage, LimitOffsetParams, paginate
from fastapi import Query
from fastapi_pagination import LimitOffsetPage, paginate

from bali.core import APIRouter, cache_memoize
from models import Item
from resources import GreeterResource, ItemResource
from resources import GreeterResource, ItemResource, ItemModelResource
from schemas import ItemModel

router = APIRouter()
Expand All @@ -28,5 +27,7 @@ def list_items():

hello_greeter_router = GreeterResource.as_router()
item_router = ItemResource.as_router()
item_model_resource_router = ItemModelResource.as_router()
router.include_router(hello_greeter_router, prefix='/hello-greeters')
router.include_router(item_router, prefix='/hello-items')
router.include_router(item_model_resource_router, prefix='/models-items')

0 comments on commit c45f559

Please sign in to comment.