Added pagination.

This commit is contained in:
Yaro Kasear 2025-09-16 13:42:34 -05:00
parent a64c64e828
commit 27431a7150
3 changed files with 78 additions and 7 deletions

View file

@ -15,6 +15,10 @@ if TYPE_CHECKING:
class Room(Base, CRUDMixin):
__tablename__ = 'rooms'
__crudkit_field_requires__ = {
"label": ["room_function"],
}
name: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True, index=True)
area: Mapped[Optional['Area']] = relationship('Area', back_populates='rooms')

View file

@ -7,4 +7,10 @@ Inventory Manager - {{ model|title }} Listing
{% block main %}
<h1 class="display-4 text-center mt-5">{{ model|title }} Listing</h1>
{{ table | safe }}
<div class="d-flex justify-content-evenly mx-5">
<button onclick="location.href='{{ url_for('listing.show_list', model=model, cursor=pagination['prev_cursor']) }}'" class="btn btn-primary" type="buttom">Prev</button>
{{ pagination['total'] }} records
<button onclick="location.href='{{ url_for('listing.show_list', model=model, cursor=pagination['next_cursor']) }}'" class="btn btn-primary" type="buttom">Next</button>
</div>
{% endblock %}