{ "info": { "author": "Greg Brown", "author_email": "greg@gregbrown.co.nz", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "Django simple search provides the same functionality and convenience\nthat ``search_fields`` does in the django admin.\n\nSee http://gregbrown.co.nz/code/django-simple-search/ for more details.\n\n|Circle CI| |codecov| |Latest Version|\n\nInstallation\n------------\n\nDownload the source from\nhttps://pypi.python.org/pypi/django-simple-search/ and run\n``python setup.py install``, or:\n\n::\n\n > pip install django-simple-search\n\nDjango 1.8 or higher is required.\n\nQuick start\n-----------\n\n::\n\n from simple_search import search_filter\n from .models import MyModel\n\n query = 'test'\n search_fields = ['^title', 'description', '=id']\n f = search_filter(search_fields, query)\n filtered = MyModel.objects.filter(f)\n\nFor convenience you can create a search form class via the provided\nfactory:\n\n::\n\n from .models import MyModel\n from simple_search import search_form_factory\n\n SearchForm = search_form_factory(MyModel.objects.all(),\n ['^title', 'description'])\n\nReference\n---------\n\n``simple_search.search_filter(search_fields, query)``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nGiven a list of ``search_fields`` to search on and a query, return a\n``models.Q`` object which can be used to filter a queryset.\n\n``search_fields`` behaves exactly like the django admin\n`search\\_fields `__\noption. Example:\n\n::\n\n search_fields = [\n # match from the start of the title field\n '^title',\n\n # match anywhere within the description field\n 'description',\n\n # match from the start of the related category's title field\n '^category__title',\n\n # exact match on object id\n '=id'\n ]\n\n``simple_search.search_form_factory(queryset, search_fields)``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nCreate a search form class which will filter ``queryset`` according to\n``search_fields`` and the form field ``q``. Example:\n\n::\n\n # forms.py\n from .models import MyModel\n from simple_search import search_form_factory\n\n SearchForm = search_form_factory(MyModel.objects.all(),\n ['^title', 'description'])\n\n # views.py\n from django.shortcuts import render\n from .forms import SearchForm\n\n @render('search.html')\n def search(request):\n form = SearchForm(request.GET or {})\n if form.is_valid():\n results = form.get_queryset()\n else:\n results = MyModel.objects.none()\n\n return {\n 'form': form,\n 'results': results,\n }\n\nRunning tests\n-------------\n\nUse tox (https://pypi.python.org/pypi/tox):\n\n::\n\n > pip install tox\n > cd path-to/django-simple-search\n > tox\n\n.. |Circle CI| image:: https://circleci.com/gh/gregplaysguitar/django-simple-search.svg?style=svg\n :target: https://circleci.com/gh/gregplaysguitar/django-simple-search\n.. |codecov| image:: https://codecov.io/gh/gregplaysguitar/django-simple-search/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/gregplaysguitar/django-simple-search\n.. |Latest Version| image:: https://img.shields.io/pypi/v/django-simple-search.svg?style=flat\n :target: https://pypi.python.org/pypi/django-simple-search/\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gregplaysguitar/django-simple-search", "keywords": "", "license": "BSD License", "maintainer": "", "maintainer_email": "", "name": "django-simple-search", "package_url": "https://pypi.org/project/django-simple-search/", "platform": "any", "project_url": "https://pypi.org/project/django-simple-search/", "project_urls": { "Homepage": "https://github.com/gregplaysguitar/django-simple-search" }, "release_url": "https://pypi.org/project/django-simple-search/1.0.2/", "requires_dist": null, "requires_python": "", "summary": "Recurring event tools for django", "version": "1.0.2" }, "last_serial": 2718831, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "29b58b0e09e7b6494b4e5414f9436e55", "sha256": "67c981a868d80bf1347683dcc4192a5c4246fb949c34aa3fc517540d05c676ca" }, "downloads": -1, "filename": "django-simple-search-1.0.0.tar.gz", "has_sig": false, "md5_digest": "29b58b0e09e7b6494b4e5414f9436e55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3862, "upload_time": "2017-03-20T21:07:39", "url": "https://files.pythonhosted.org/packages/64/96/e229012663bb3865570de39fe9cbc2e9cde3164950c9a08e88cc016c0469/django-simple-search-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "2475d839459d3a53924eae91caa59f6a", "sha256": "2ee0479bb821cba2f37cd29115f49fce052b5cc55b51f6e8bac6adefaf72564b" }, "downloads": -1, "filename": "django-simple-search-1.0.1.tar.gz", "has_sig": false, "md5_digest": "2475d839459d3a53924eae91caa59f6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4974, "upload_time": "2017-03-20T21:12:36", "url": "https://files.pythonhosted.org/packages/27/87/3ae03d731e640325e9c7c6fae19d77f14435d3b9c8cc4171b2b2c7e030d3/django-simple-search-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "b54eb4a4517b867a5784d207b183b588", "sha256": "5edaa08c610bf49f8b51de2cfe3e168457a821916e732c82c562ba1ab8ed4743" }, "downloads": -1, "filename": "django-simple-search-1.0.2.tar.gz", "has_sig": false, "md5_digest": "b54eb4a4517b867a5784d207b183b588", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4984, "upload_time": "2017-03-20T21:18:10", "url": "https://files.pythonhosted.org/packages/ce/ce/6c07387b07de2e69710b8c313d426acbb735e8e99226dd230af58cea8cfc/django-simple-search-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b54eb4a4517b867a5784d207b183b588", "sha256": "5edaa08c610bf49f8b51de2cfe3e168457a821916e732c82c562ba1ab8ed4743" }, "downloads": -1, "filename": "django-simple-search-1.0.2.tar.gz", "has_sig": false, "md5_digest": "b54eb4a4517b867a5784d207b183b588", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4984, "upload_time": "2017-03-20T21:18:10", "url": "https://files.pythonhosted.org/packages/ce/ce/6c07387b07de2e69710b8c313d426acbb735e8e99226dd230af58cea8cfc/django-simple-search-1.0.2.tar.gz" } ] }