{ "info": { "author": "Itay Zandbank", "author_email": "zmbq@platonix.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "djqgrid\n=======\n\n``djqgrid`` is a Django wrapper for jqGrid.\n\n``djqgrid`` lets you define grids in a Django-familiar way, while taking care of most of the mundane Python-JavaScript bridge for you.\n\nYou can find the documents at ReadTheDocs_.\n\n.. _ReadTheDocs: http://djqgrid.readthedocs.org\n\nQuick Example\n-------------\n\nAdd ``djqgrid`` to your project\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n1. Install with ``pip install djqgrid``\n2. Add ``djqgrid`` to your ``INSTALLED_APPS``.\n3. Reference the ``jqGrid`` and ``jQueryUI`` JavaScript and CSS files \n4. Reference the script at ``{% static \"js/djqgrid_utils.js\" %}``\n5. Add the ``djqgrid`` URLs to ``urls.py``:\n ::\n \n urlpatterns += patterns('', url(r^'grid_json/', include (djqgrid.urls))\n\nDefine your model\n^^^^^^^^^^^^^^^^^\n::\n\n class MyModel(models.Model):\n name = models.CharField(max_length=40)\n desc = models.CharField(max_length=100)\n url = models.URLField()\n height = models.IntField()\n\nDefine your grid\n^^^^^^^^^^^^^^^^ \n::\n\n class MyGrid(Grid):\n model = MyModel \n\n name = TextColumn(title='Name', model_path='name')\n height = TextColumn(title='Height', model_path='height', align='right')\n desc = LinkColumn(title='Description', model_path='desc', url_builder=lambda m: m.url)\n\nWhat we have here is a grid associated with ``MyModel`` objects - each grid row represents one object. The grid has three columns:\n\n1. Name - a basic column containing ``model.name``\n2. Height - containing ``model.height``, but right aligned\n3. Description - containing a link - its text will be ``model.desc`` and the URL will be ``model.url``\n \nOne 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.\n\nAdd the grid to your view and template\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe view: ::\n\n define myview(request):\n grid = MyGrid()\n return render(request, 'my_template.html', { grid: grid })\n \n\nThe template: ::\n\n {% load djqgrid %}\n \n