Pyramid Listing
Pyramid Listing contains pyramid resources and helpers for pagination of result lists.
A lot of pyramid applications that use a (SQL) database need to list the result of queries. This result list might get quite long and are split into several pages. This package is offering some help in this.
Quickstart
Lets assume, that you’d like to start a cheese shop and define a simple database model in the pyramid application:
from .meta import Base
class Cheese(Base):
id = Column(Integer, primary_key=True)
name = Column(Text, nullable=False)
To get a result list including pagination, just create a sub-class from pyramid_listing.SQLAlchemyListing and define a get_base_query method:
from pyramid_listing import SQLAlchemyListing
class CheeseList(SQLAlchemyListing):
def get_base_query(self, request)
return request.dbsession.query(Cheese)
In a view you could then use this class to autmagically get paged results:
@view_config(route_name='cheeses')
def cheese_list_view(request):
listing = CheeseList(request)
return {'cheeses': listing.items(), 'pagination': listing.pages}
With this URLs you could access different result pages:
shows page 3:
https://example.com/cheeses?p=3
shows page 1 with 42 items per page:
Features
automatically calculate pagination information like first, next or last page from pyradmid.request.GET parameters
loading configuration defaults from .ini files
easily implement ordering and filtering of results
helper method for creating pyradmid.request.GET parameters for different pages
base class for listings as location aware pyramid resources
Example Project
To see this in action install the sample project from https://github.com/holgi/pyramid_listing_example and take a look at it
Metadata
Release files for pyramid_listing 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyramid_listing-0.2.2.tar.gz | 31.5 kB | Without provenance | Details for pyramid_listing-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyramid_listing-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for pyramid_listing-0.2.2-py3-none-any.whl |
Total release size: 45.1 kB
Release files / pyramid_listing-0.2.2.tar.gz
| Download URL | pyramid_listing-0.2.2.tar.gz |
|---|---|
| Size | 31.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
993ce9d3913e64262e8481d7c78b05af88257d4bf9909d47224dc692095a9ef7
|
|
BLAKE2b-256 checksum How to use checksums |
e03a0580ea71f174b1751c607ae6b391f1c7b806ba49737d99a95cf15d594a6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.22.0
|
Release files / pyramid_listing-0.2.2-py3-none-any.whl
| Download URL | pyramid_listing-0.2.2-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b5c9b33f171131364760fa6a9db380fced362dc787c4fe40dfbb06af90ae11e
|
|
BLAKE2b-256 checksum How to use checksums |
4e52ba9915158eb5a6264bb67b765ef78cc2f05659db41d846b0c9b09d371dd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.22.0
|
Security for pyramid_listing 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.