No project description provided
Project description
Generic Table
A Python package that provides features for managing and manipulating tables with:
- Pagination
- Filtering
- Sorting
- Excel Data Export
That provides the GenericTable frontend component with everything it needs.
📦 Installation
Install via pip
To install the package from PyPI, run the following command:
pip install generic-table
Usage
View Table Data with Pagination, Filtering, and Sorting
Use the view function to apply pagination, filtering, and sorting to a Django queryset. Here’s an example:
from myapp.models import WorkOrder
from generic_table import view # Importing the view function from the package
def get_work_orders(request):
# Get all work orders (simple queryset)
qs = WorkOrder.objects.all()
# Define the counted values for the 'status' field
counted_values = ['IN_PROGRESS', 'APPROVED', 'CANCELLED', 'COMPLETED']
# Use the `view` function from the `generic_table` package to return the response
return view(
qs,
request,
field="status", # The field to count/filter by
counted_values=counted_values,
values_list=[
"id", "status", "number", "description"
], # Fields to return in the response
data_key="workOrders", # The key to map the data in the response
)
2. Handling Excel Exports
You can also export table data to Excel.
It looks for an Accept header with value of "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
from generic_table.generic_table import view
from myapp.models import MyModel
def export_data(request):
queryset = MyModel.objects.all()
field = 'status'
counted_values = ['active', 'inactive']
return view(queryset, request, field, counted_values, values_list=['status', 'id'])
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file generic_table-1.1.0.tar.gz.
File metadata
- Download URL: generic_table-1.1.0.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f60797be6c2338a4e3b98ca1487df88743408728e1583ba5948257487c1040b
|
|
| MD5 |
4b2b6dd7009f619f360f2660e2e8912e
|
|
| BLAKE2b-256 |
c0902fb4a93fa5292a8609c8c4978dfe8bbef74bce006fb5f0ea2c667e6afa1a
|
Provenance
The following attestation bundles were made for generic_table-1.1.0.tar.gz:
Publisher:
publish.yml on TechServ-Consulting-Training-Ltd/generic-table
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
generic_table-1.1.0.tar.gz -
Subject digest:
6f60797be6c2338a4e3b98ca1487df88743408728e1583ba5948257487c1040b - Sigstore transparency entry: 174255619
- Sigstore integration time:
-
Permalink:
TechServ-Consulting-Training-Ltd/generic-table@36f566fce32bb75fab6eb581a579345b4ef49a3a -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/TechServ-Consulting-Training-Ltd
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@36f566fce32bb75fab6eb581a579345b4ef49a3a -
Trigger Event:
release
-
Statement type:
File details
Details for the file generic_table-1.1.0-py3-none-any.whl.
File metadata
- Download URL: generic_table-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed405b21a30a3118bc9ef39775424e90944a4a49d36012935d0af9cd2210bf07
|
|
| MD5 |
c29e55856a13c4e34b510a5ba775c3ff
|
|
| BLAKE2b-256 |
9f8883ff32b4e9371ad8e001d26b667ae328acee212599cb4045b81e4de43b52
|
Provenance
The following attestation bundles were made for generic_table-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on TechServ-Consulting-Training-Ltd/generic-table
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
generic_table-1.1.0-py3-none-any.whl -
Subject digest:
ed405b21a30a3118bc9ef39775424e90944a4a49d36012935d0af9cd2210bf07 - Sigstore transparency entry: 174255620
- Sigstore integration time:
-
Permalink:
TechServ-Consulting-Training-Ltd/generic-table@36f566fce32bb75fab6eb581a579345b4ef49a3a -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/TechServ-Consulting-Training-Ltd
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@36f566fce32bb75fab6eb581a579345b4ef49a3a -
Trigger Event:
release
-
Statement type: