def test_duplicate_fields(client): with pytest.raises( ValueError, match= "Sort field\\(s\\) cannot be passed as both positional and keyword arguments", ): Sorting("name", "date", date=True)
class WidgetListView(GenericModelView): model = models['widget'] schema = schemas['widget'] sorting = Sorting('name', 'size') def get(self): return self.list()
class WidgetListView(GenericModelView): model = models["widget"] schema = schemas["widget"] sorting = Sorting("name", "size") def get(self): return self.list()
class InterfaceAddressListView(InterfaceAddressViewBase): sorting = Sorting("id", default="-id") def get(self): return self.list() def post(self): return self.create()
class RelayCursorListView(WidgetViewBase): sorting = Sorting('id', 'size') pagination = RelayCursorPagination(2) def get(self): return self.list() def post(self): return self.create()
class AuthorViewBase(GenericModelView): model = models.Author schema = schemas.AuthorSchema() authentication = NoOpAuthentication() authorization = NoOpAuthorization() pagination = PagePagination(page_size=10) sorting = Sorting("created_at", default="-created_at")
class PeerListView(PeerViewBase): filtering = Filtering(name=ColumnFilter(operator.eq, required=True)) sorting = Sorting("id", default="-id") def get(self): return self.list() def post(self): return self.create()
class BookViewBase(GenericModelView): model = models.Book schema = schemas.BookSchema() authentication = NoOpAuthentication() authorization = NoOpAuthorization() pagination = PagePagination(page_size=10) sorting = Sorting("published_at", default="-published_at") filtering = Filtering(author_id=ColumnFilter(operator.eq, required=True))
class FooListView(FooViewBase): spec_declaration = ModelViewDeclaration(many=True) filtering = Filtering(color=operator.eq, ) sorting = Sorting('name', 'color') pagination = PagePagination(2) def get(self): pass def post(self): """test the docstring""" pass
class WidgetListView(GenericModelView): model = models["widget"] schema = schemas["widget"] sorting = Sorting( "name", "size", content_length=sql.func.length(Widget.content), content_length2=lambda model, field_name: sql.func.length(model. content), ) def get(self): return self.list()
class FooListView(GenericModelView): schema = schemas['foo']() spec_declaration = ModelViewDeclaration(many=True) filtering = Filtering(color=operator.eq, ) sorting = Sorting('name', 'color') pagination = PagePagination(2) def get(self): pass def post(self): """test the docstring""" pass
class RelayCursorListView(WidgetListViewBase): sorting = Sorting("id", "size") pagination = RelayCursorPagination(2)