{ "info": { "author": "Giuseppe De Marco", "author_email": "giuseppe.demarco@unical.it", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: BSD License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3 :: Only" ], "description": "# Django Datatables server processing\nLightweight Django class for a full Datatables server processing implementation.\n\nhttps://datatables.net/examples/data_sources/server_side.html\n\nAfter hanging around for a good integration of Datatables server processing in Django, I tested the things I found on internet but they all have the same problem, they cannot manage the ForeignKey relations as well. After all, I made it by myself.\n\nThis code was tested on Datatables 1.10.+ and Django 1.10.+.\n\nTo get it works just put datatables in your html template, like this:\n\n```html\n \n \n \n \n\n \n \n```\n\nRequirements\n------------\n\nDownload your preferred DataTables release from [here](https://datatables.net/download/).\n\nSetup and examples\n------------------\nInstall package in your Python environment.\n````\npip install git+https://github.com/peppelinux/django-datatables-ajax.git\n````\n\nCreate a view\n````\nfrom django.conf import settings\nfrom django.contrib.auth.decorators import login_required\nfrom django.db.models import Q\nfrom django.http import HttpResponse, Http404\nfrom django.http.response import HttpResponseRedirect\nfrom django.http import JsonResponse\n\nfrom .datatables import DjangoDatatablesServerProc\n\n@login_required\ndef datatable_data(request):\n radcheck = get_radcheck_active(request)\n radius_accounts = _get_radius_accounts(request, radcheck)\n\n model = RadiusPostAuth\n columns = ['pk', 'username', 'reply', 'calling_station_id', 'date']\n\n base_query = model.objects.filter(username__in=[i.username for i in radius_accounts]).exclude(calling_station_id='').order_by('-date')\n\n class DTD(DjangoDatatablesServerProc):\n def get_queryset(self):\n if self.search_key:\n self.aqs = base_query.filter(\n Q(username__icontains=self.search_key) | \\\n Q(reply__icontains=self.search_key) | \\\n Q(calling_station_id__icontains=self.search_key))\n else:\n self.aqs = base_query.filter(username=radcheck.username)\n\n\n dtd = DTD( request, model, columns )\n return JsonResponse(dtd.get_dict())\n````\n\nCreate an url resource\n````\nfrom django.conf.urls import include, url\nfrom django.contrib.auth.decorators import login_required\n\nfrom .views import *\n\nurlpatterns = [\n url(r'^datatable.json$', login_required(StatoUtenzaCorso_DTJson), name='datatable_json'),\n]\n````\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/peppelinux/django-datatables-ajax", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-datatables-ajax", "package_url": "https://pypi.org/project/django-datatables-ajax/", "platform": "", "project_url": "https://pypi.org/project/django-datatables-ajax/", "project_urls": { "Homepage": "https://github.com/peppelinux/django-datatables-ajax" }, "release_url": "https://pypi.org/project/django-datatables-ajax/0.8/", "requires_dist": [ "django" ], "requires_python": "", "summary": "Lightweight Django class for a full Datatables server processing implementation", "version": "0.8" }, "last_serial": 4874932, "releases": { "0.6": [ { "comment_text": "", "digests": { "md5": "0d934ec055e6d4b448c63fc53f279aa8", "sha256": "fcaad631c3156261f8d4055f6f6671b8dcdb3d532ad4e451663bc1accc4234f3" }, "downloads": -1, "filename": "django_datatables_ajax-0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "0d934ec055e6d4b448c63fc53f279aa8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14617, "upload_time": "2019-02-09T15:31:28", "url": "https://files.pythonhosted.org/packages/1a/55/e02da4daf46ad34e8a1a3ba6995bbc73bcd6febe0e7678f02db03fd2a93d/django_datatables_ajax-0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f5c4eea1b513d07fca8c29b627eba6a5", "sha256": "f3622222dd5286615616f76294d0e18992fe4a46748500815aa4d7dec1f94fff" }, "downloads": -1, "filename": "django-datatables-ajax-0.6.tar.gz", "has_sig": false, "md5_digest": "f5c4eea1b513d07fca8c29b627eba6a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3590, "upload_time": "2019-02-09T15:31:30", "url": "https://files.pythonhosted.org/packages/32/a8/b2be295f4bc1d7f07de4c0d049aadcf3e26a81e8a7d92f963f3aa802a595/django-datatables-ajax-0.6.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "e0cda25a5e36180490ffcdf8a48bbcd9", "sha256": "7344dcce2d16839dc1cc6fe29652f322ab85b0121f3a587a5fc0244bdb29b922" }, "downloads": -1, "filename": "django_datatables_ajax-0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "e0cda25a5e36180490ffcdf8a48bbcd9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5377, "upload_time": "2019-02-27T15:52:36", "url": "https://files.pythonhosted.org/packages/2e/19/91921a4aa1410e3294a872e43e1c5f8e63ab6dc933b7cec31b80bf795669/django_datatables_ajax-0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "412dfd118f1c7b14fc3bcdc9b466005e", "sha256": "b77de960eb311c4603f3c34bd0b4e4486ae6be1c0f7e32fa5333390b3a667c84" }, "downloads": -1, "filename": "django-datatables-ajax-0.8.tar.gz", "has_sig": false, "md5_digest": "412dfd118f1c7b14fc3bcdc9b466005e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4121, "upload_time": "2019-02-27T15:52:38", "url": "https://files.pythonhosted.org/packages/c8/c0/ac4d0f9d400234e2db6628816c3c771ce436507ee69dae6e78578c49abf2/django-datatables-ajax-0.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e0cda25a5e36180490ffcdf8a48bbcd9", "sha256": "7344dcce2d16839dc1cc6fe29652f322ab85b0121f3a587a5fc0244bdb29b922" }, "downloads": -1, "filename": "django_datatables_ajax-0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "e0cda25a5e36180490ffcdf8a48bbcd9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5377, "upload_time": "2019-02-27T15:52:36", "url": "https://files.pythonhosted.org/packages/2e/19/91921a4aa1410e3294a872e43e1c5f8e63ab6dc933b7cec31b80bf795669/django_datatables_ajax-0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "412dfd118f1c7b14fc3bcdc9b466005e", "sha256": "b77de960eb311c4603f3c34bd0b4e4486ae6be1c0f7e32fa5333390b3a667c84" }, "downloads": -1, "filename": "django-datatables-ajax-0.8.tar.gz", "has_sig": false, "md5_digest": "412dfd118f1c7b14fc3bcdc9b466005e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4121, "upload_time": "2019-02-27T15:52:38", "url": "https://files.pythonhosted.org/packages/c8/c0/ac4d0f9d400234e2db6628816c3c771ce436507ee69dae6e78578c49abf2/django-datatables-ajax-0.8.tar.gz" } ] }