Powerful package and easy to use that simplifies the creation of pagination in your apps
Project description
pagecraft
Powerful package and easy to use that simplifies the creation of pagination in your apps
Installing
pip install pagecraft
Tutorial
from pagecraft import PageCraft
lista_de_objetos = [
"Automatización Eficiente con Python",
"Explorando las Profundidades de Python",
"Desarrollo Web Moderno con Python y Flask",
"Introducción a la Ciencia de Datos con Python",
"Creando Aplicaciones de Escritorio con Python y PyQt",
"Aventuras en el Aprendizaje Automático con Python",
"Python y la Internet de las Cosas (IoT)",
]
pgcraft = PageCraft(lista_de_objetos)
# Get first page
page = pgcraft.page(1)
PageCraftAlchemy Tutorial
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.orm import sessionmaker, declarative_base
from pagecraft.alchemy import PageCraftAlchemy
Base = declarative_base()
class Frases(Base):
__tablename__ = "frases"
id = Column(Integer, primary_key=True)
texto = Column(String)
def __str__(self):
return self.texto
engine = create_engine("sqlite:///:memory:")
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
session = Session()
for i in range(1, 21):
frase = Frases(texto=f"Frase {i}")
session.add(frase)
session.commit()
query = session.query(Frases)
alchemycraft = PageCraftAlchemy(query)
# Get first page
page = alchemycraft.page(1)
Accessing data:
# Get data from page
page.data
# True or False if next page exists
page.has_next_page
# Get the next page number
page.next_page
# True or False if prev page exists
page.has_prev_page
# Get the prev page number
page.prev_page
# Get the current page number
page.number
Extend the data returned
# set integer number as second argument
pgcraft = PageCraft(lista_de_objetos,20)
alchemycraft = PageCraftAlchemy(query , 20)
Release Notes (0.0.6)
- add PageCraftAlchemy : create easy pagination for Sqlalchemy ORM
- now there are 10 items returned by default
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pagecraft-0.0.6.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file pagecraft-0.0.6.tar.gz
.
File metadata
- Download URL: pagecraft-0.0.6.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be0788f6580fb8306188017ff5c2083130e39791350dc8a0e9b94d0c97d8f3fb |
|
MD5 | 8dcc2d1ce30f689485ca89bccde728e3 |
|
BLAKE2b-256 | 439b542410404d661aa825414796b88b887e602cdbec6bf1b2eb4e0a78fcd8e2 |
File details
Details for the file pagecraft-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: pagecraft-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3566202888cd0ef2948735473fad243c3fb99f67a9733bde3276abf6c0ad3c96 |
|
MD5 | 6d1219f89f841bdbee837a665c8e6d59 |
|
BLAKE2b-256 | 0fce63ba0d9811dcd3e5465a6514703f81d62379c1dc9dde3d1052cb7e7d00d8 |