{ "info": { "author": "Peter Schueler", "author_email": "peter@orangemirrorentertainment.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 2.1", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "# Django-Searchly-Tables\n\nA simple Django app that adds search and sort to HTML tables.\n\nI like using simple views, but it should work with class-based views as well (but I haven't tested it).\n\n## Example\n\nAdd `searchly_tables` to your `INSTALLED_APPS`:\n\n\tINSTALLED_APPS = (\n\t\t...,\n\t\t\"searchly_tables\",\n\t)\n\nIn your view.py, import searchly_tables, add a new table to a view,\nand specify for which model you would like to use it:\n\n\tfrom django.shortcuts import render\n\n\tfrom example.model import ExampleModel\n\tfrom searchly_tables.tables import SearchlyTable\n\n\tdef view(request):\n\t\ttable = SearchlyTable(module=\"exampleapp.models\", model=\"ExampleModel\", field_filters=field_filters)\n\t\ttable.labels = {'baseField1': 'labelForBaseField1', 'foreignkey_relationship': 'labelForForeignKeyRelationship', 'baseField2': 'labelForBaseField2'}\n\n\t\t# Optional links to models in fields\n\t\ttable.field_links = {'baseField2': ['app:view': 'url_parameter']}\n\t\tif request.POST:\n\t\t\ttable.post(request.POST, filter=True, sort=True)\n\t\treturn render(request, 'example/table.html', {'table': table})\n\nThen add the table to your template like this:\n\n\t
\n\nAnd that's it! Naturally, you can change the appearance of the table by applying CSS.\n\nFor instance `table.attrs['td'] = 'my_td_class'` would result in `