djqgrid
djqgrid is a Django wrapper for jqGrid.
djqgrid lets you define grids in a Django-familiar way, while taking care of most of the mundane Python-JavaScript bridge for you.
You can find the documents at ReadTheDocs.
Quick Example
Add djqgrid to your project
Install with pip install djqgrid
Add djqgrid to your INSTALLED_APPS.
Reference the jqGrid and jQueryUI JavaScript and CSS files
Reference the script at {% static "js/djqgrid_utils.js" %}
Add the djqgrid URLs to urls.py:
urlpatterns += patterns('', url(r^'grid_json/', include (djqgrid.urls))
Define your model
class MyModel(models.Model):
name = models.CharField(max_length=40)
desc = models.CharField(max_length=100)
url = models.URLField()
height = models.IntField()
Define your grid
class MyGrid(Grid):
model = MyModel
name = TextColumn(title='Name', model_path='name')
height = TextColumn(title='Height', model_path='height', align='right')
desc = LinkColumn(title='Description', model_path='desc', url_builder=lambda m: m.url)
What we have here is a grid associated with MyModel objects - each grid row represents one object. The grid has three columns:
Name - a basic column containing model.name
Height - containing model.height, but right aligned
Description - containing a link - its text will be model.desc and the URL will be model.url
One thing to note is align='right' - this property is passed directly to jqGrid in the column’s colModel. Any property can be passed to jqGrid this way. For example TextColumn(title=..., model_path=..., editable=true) creates an editable column.
Add the grid to your view and template
The view:
define myview(request):
grid = MyGrid()
return render(request, 'my_template.html', { grid: grid })
The template:
{% load djqgrid %}
<div id="grid-div">
{% jqgrid grid %}
</div>
Now run the view. You should see a very nice grid that supports paging and sorting.
Metadata
Release files for djqgrid 0.2.4
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 | |
|---|---|---|---|---|
| djqgrid-0.2.4.zip | 452.8 kB | Without provenance | Details |
Release files / djqgrid-0.2.4.zip
| Download URL | djqgrid-0.2.4.zip |
|---|---|
| Size | 452.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87088d1f99ed925da724bfa680976e058c0f526d2eabfc7c14fc511fde1f117d
|
|
BLAKE2b-256 checksum How to use checksums |
10c33f25638e4de7e51f2008ef1f8a29fdba8ca744352dcffb56648fe69cbc31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for djqgrid 0.2.4
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.