{ "info": { "author": "Tom", "author_email": "tom@tomforb.es", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Flask", "Framework :: Pyramid", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "===============================================\ndatatables |PyPi Version| |TravisCI| |Coverage|\n===============================================\n\n.. |PyPi Version| image:: http://img.shields.io/pypi/v/datatables.svg?style=flat\n :target: https://pypi.python.org/pypi/datatables\n\n.. |TravisCI| image:: https://api.travis-ci.org/orf/datatables.svg\n :target: https://travis-ci.org/orf/datatables\n\n.. |Coverage| image:: https://coveralls.io/repos/orf/datatables/badge.png?branch=master\n :target: https://coveralls.io/r/orf/datatables?branch=master\n\n\n\n\nInstallation\n------------\n\nThe package is available on `PyPI `_ and is tested on Python 2.7 to 3.4\n\n.. code-block:: bash\n\n pip install datatables\n\nUsage\n-----\n\nUsing Datatables is simple. Construct a DataTable instance by passing it your request parameters (or another dict-like\nobject), your model class, a base query and a set of columns. The columns list can contain simple strings which are\ncolumn names, or tuples containing (datatable_name, model_name), (datatable_name, model_name, filter_function) or\n(datatable_name, filter_function).\n\nAdditional data such as hyperlinks can be added via DataTable.add_data, which accepts a callable that is called for\neach instance. Check out the usage example below for more info.\n\n\nExample\n-------\n\n**models.py**\n\n.. code-block:: python\n\n class User(Base):\n __tablename__ = 'users'\n\n id = Column(Integer, primary_key=True)\n full_name = Column(Text)\n created_at = Column(DateTime, default=datetime.datetime.utcnow)\n\n # Use lazy=joined to prevent O(N) queries\n address = relationship(\"Address\", uselist=False, backref=\"user\", lazy=\"joined\")\n\n class Address(Base):\n __tablename__ = 'addresses'\n\n id = Column(Integer, primary_key=True)\n description = Column(Text, unique=True)\n user_id = Column(Integer, ForeignKey('users.id'))\n\n**views.py**\n\n.. code-block:: python\n\n @view_config(route_name=\"data\", request_method=\"GET\", renderer=\"json\")\n def users_data(request):\n # User.query = session.query(User)\n table = DataTable(request.GET, User, User.query, [\n \"id\",\n (\"name\", \"full_name\", lambda i: \"User: {}\".format(i.full_name)),\n (\"address\", \"address.description\"),\n ])\n table.add_data(link=lambda o: request.route_url(\"view_user\", id=o.id))\n table.searchable(lambda queryset, user_input: perform_some_search(queryset, user_input))\n\n return table.json()\n\n**template.jinja2**\n\n.. code-block:: html\n\n \n \n \n \n \n \n \n \n \n \n
IdUser nameAddress
\n\n ", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/orf/datatables/", "keywords": "sqlalchemy datatables jquery pyramid flask", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "ninchanese-datatables", "package_url": "https://pypi.org/project/ninchanese-datatables/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ninchanese-datatables/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/orf/datatables/" }, "release_url": "https://pypi.org/project/ninchanese-datatables/0.5.1/", "requires_dist": null, "requires_python": null, "summary": "Integrates SQLAlchemy with DataTables (framework agnostic) - Containing fixes for ninchanese.com", "version": "0.5.1" }, "last_serial": 2329294, "releases": { "0.5.1": [ { "comment_text": "", "digests": { "md5": "ccaec4f6513f92eada722f07dbdadcd1", "sha256": "ecb93b0d52b70625d9b7c28e52b30560def68cfb262233f7198d8f759cf83c65" }, "downloads": -1, "filename": "ninchanese_datatables-0.5.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ccaec4f6513f92eada722f07dbdadcd1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 7432, "upload_time": "2016-09-07T12:02:32", "url": "https://files.pythonhosted.org/packages/d3/5b/2857f9ee92d40d8bb5baca6ef4ac13795c4eb116706f2fa3bc64210a72c1/ninchanese_datatables-0.5.1-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ccaec4f6513f92eada722f07dbdadcd1", "sha256": "ecb93b0d52b70625d9b7c28e52b30560def68cfb262233f7198d8f759cf83c65" }, "downloads": -1, "filename": "ninchanese_datatables-0.5.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ccaec4f6513f92eada722f07dbdadcd1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 7432, "upload_time": "2016-09-07T12:02:32", "url": "https://files.pythonhosted.org/packages/d3/5b/2857f9ee92d40d8bb5baca6ef4ac13795c4eb116706f2fa3bc64210a72c1/ninchanese_datatables-0.5.1-py2.py3-none-any.whl" } ] }